//Scale font sizes void Start() { globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); //Scale font size to resolution gameOverText.fontSize = (int)(globalVars.screenRatio * gameOverText.fontSize); generalText.fontSize = (int)(globalVars.screenRatio * generalText.fontSize); returnButton.GetComponentInChildren <Text>().fontSize = (int)(globalVars.screenRatio * generalText.fontSize); }
private int moveZ; //variable for bobber movement on z coordinate // Use this for initialization void Start() { playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); trashOnLine = false; inWater = false; hasBite = false; gameStarted = false; trashText = GameObject.FindGameObjectWithTag("TrashText").GetComponent <Text>(); splashAudio = this.gameObject.GetComponent <AudioSource> (); lastFishInWater = globalVars.fishInWater; }
void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { minigameStart = false; isOverlapping = false; thisObject = this.gameObject; thisRB = thisObject.GetComponent <Rigidbody2D> (); bobberScript = GameObject.FindGameObjectWithTag("Bobber").GetComponent <RodCastInWater> (); globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); progressBar = GameObject.FindGameObjectWithTag("ProgressBar").GetComponent <Slider> (); progressBar.value = .5f; fishText = GameObject.FindGameObjectWithTag("FishText").GetComponent <Text>(); startGame(); }
// Use this for initialization void Start() { GameObject gvsGameObj = GameObject.FindGameObjectWithTag("GlobalVariables"); if (gvsGameObj != null) { gvs = gvsGameObj.GetComponent <GlobalVariablesScript>(); } else { Debug.LogError("GVS NOT FOUND"); this.enabled = false; } //gvs = (GlobalVariablesScript)GameObject.FindGameObjectWithTag ("GlobalVariables"); }
//Initialize global variables and adjust font sizes void Start() { globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); fontSize = (int)(globalVars.screenRatio * titleText.fontSize); titleText.fontSize = fontSize; instructionsTitle.fontSize = fontSize; loadText.GetComponentInChildren <Text> ().fontSize = fontSize; fontSize = (int)(globalVars.screenRatio * startButton.GetComponentInChildren <Text>().fontSize); startButton.GetComponentInChildren <Text> ().fontSize = fontSize; instructionsButton.GetComponentInChildren <Text> ().fontSize = fontSize; quitButton.GetComponentInChildren <Text> ().fontSize = fontSize; nextButton.GetComponentInChildren <Text> ().fontSize = fontSize; instructionsText.GetComponentInChildren <Text> ().fontSize = fontSize; creditsText.GetComponentInChildren <Text> ().fontSize = fontSize; creditsButton.GetComponentInChildren <Text> ().fontSize = fontSize; }
// Use this for initialization void Start() { globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); textToUpdate.text = "Time Remaining: " + (int)timeStart; fishText = GameObject.FindGameObjectWithTag("FishText").GetComponent <Text>(); fishText.text = "Fish: " + globalVars.fishInWater; trashText = GameObject.FindGameObjectWithTag("TrashText").GetComponent <Text>(); trashText.text = "Trash: " + globalVars.trashInWater; if (globalVars.currentLevel == 1) { timeStart = 30.0f; instructionsPanel.SetActive(!instructionsPanel.activeSelf); instructionsText.gameObject.SetActive(!instructionsText.gameObject.activeSelf); fontSize = (int)(globalVars.screenRatio * instructionsText.GetComponentInChildren <Text>().fontSize); instructionsText.GetComponentInChildren <Text> ().fontSize = fontSize; } timeRemaining = timeStart; }
void Start() { globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); for (int i = 0; i < globalVars.trashInWater; i++) { randomize = (int)Random.Range(0.0f, 2.9f); //randomize x and z position from (25,-90) to (-60,90) x = Random.Range(-60.0f, 25.0f); z = Random.Range(-90.0f, 90.0f); //randomize rotation in water yRot = Random.Range(0.0f, 350.0f); switch (randomize) { case 0: trashCopy = (GameObject)Instantiate(trashPrefab, new Vector3(x, -2.0f, z), Quaternion.identity /*Euler(new Vector3(0,yRot,-70))*/); trashCopy.transform.Rotate(-70, yRot, 0); break; case 1: trashCopy = (GameObject)Instantiate(trashPrefab2, new Vector3(x, -1.0f, z), Quaternion.identity /*Euler(new Vector3(0,yRot,-70))*/); trashCopy.transform.Rotate(-70, yRot, 0); break; case 2: trashCopy = (GameObject)Instantiate(trashPrefab3, new Vector3(x, 0.0f, z), Quaternion.identity /*Euler(new Vector3(0,yRot,15))*/); trashCopy.transform.Rotate(0, yRot, 15); break; default: Debug.Log("Error in assigning prefab to trash"); break; } //trashCopy = (GameObject) Instantiate (trashPrefab, new Vector3(x, y, z), Quaternion.Euler(new Vector3(0,yRot,-70))); } }
void Start() { globalVars = GameObject.Find("GlobalVariables").GetComponent <GlobalVariablesScript>(); }
void Awake() { //Set globalVars script object globalVars = GameObject.FindGameObjectWithTag("GlobalVariables").GetComponent <GlobalVariablesScript> (); }