// Use this for initialization void Start() { lives = GameController.instance.lives; SetNumbersToUI(); BG_1.SetActive(false); BG_2.SetActive(false); BG_3.SetActive(false); BG_4.SetActive(false); //print(GameController.instance.selectedWorld); switch (GameController.instance.selectedWorld) { case 1: BG_1.SetActive(true); break; case 2: BG_2.SetActive(true); break; case 3: BG_3.SetActive(true); break; case 4: BG_4.SetActive(true); break; default: BG_1.SetActive(true); break; } }
// Only have one GameManager at any one time //void Awake() //{ // if (GM_Script == null) // { // DontDestroyOnLoad(gameObject); // GM_Script = this; // } // // If theres more than one instance // else if (GM_Script != null) // { // Destroy(gameObject); // } //} // Start is called before the first frame update void Start() { // X-Mas Mode (Game_1) if (SceneManager.GetActiveScene().name == "Game_1" || SceneManager.GetActiveScene().name == "Game_2") { // Get the player script P_Script = FindObjectOfType <Player_Script>(); // Get the animator SceneSwitchAnim = GameObject.Find("UI_Canvas/LoadingAnim").GetComponent <Animator>(); // Play the animation SceneSwitchAnim.SetBool("Game_1", true); scoreText = GameObject.Find("UI_Canvas/Kills").GetComponent <Text>(); obs_spawner1 = GameObject.Find("Obsticle_Spawner_1"); obs_spawner2 = GameObject.Find("Obsticle_Spawner_2"); obs_spawner3 = GameObject.Find("Obsticle_Spawner_3"); //Start the speeds // NOTE - Grab the elf and obsticle prefabs (as they spawn), otherwise assign BG from the hirecahy and NOT thier prefabs elf.GetComponent <Elf_Script>().speed = 4f; small_Obs.GetComponent <Obsticle_Script>().speed = 4f; med_Obs.GetComponent <Obsticle_Script>().speed = 4f; big_Obs.GetComponent <Obsticle_Script>().speed = 4f; BG_1.GetComponent <RepeatingBG_Script>().speed = 7f; BG_2.GetComponent <RepeatingBG_Script>().speed = 7f; BG_3.GetComponent <RepeatingBG_Script>().speed = 4f; BG_4.GetComponent <RepeatingBG_Script>().speed = 4f; BG_5.GetComponent <RepeatingBG_Script>().speed = 2f; BG_6.GetComponent <RepeatingBG_Script>().speed = 2f; // Get the screen GameOver_Canvas = GameObject.Find("UI_Canvas/GameOver_Panel").GetComponent <Canvas>(); deathText = GameObject.Find("UI_Canvas/GameOver_Panel/Score").GetComponent <Text>(); // Off GameOver_Canvas.enabled = false; } }