void Start() { gc = GameObject.Find("CityGameController").GetComponent <CityGameController> (); // Get Level from Scene name string sceneName = SceneManager.GetActiveScene().name; LevelEnum lvlEnum = (LevelEnum)Enum.Parse(typeof(LevelEnum), sceneName); level = ApplicationController.ac.levels [lvlEnum]; //PausePanel shoplist = transform.Find("PauseMenuPanel/ShopList").gameObject; buttons_1 = transform.Find("PauseMenuPanel/Buttons_1").gameObject; totalKittyzText = transform.Find("PauseMenuPanel/Buttons_1/KittyzPanel/KittyzText").gameObject.GetComponent <Text> (); buttonNext = transform.Find("PauseMenuPanel/Buttons_2/NextLevelButton").gameObject; buttonResume = transform.Find("PauseMenuPanel/Buttons_2/ResumeButton").gameObject; pauseTitle = transform.Find("PauseMenuPanel/Title").gameObject; kittyzTxt = transform.Find("PauseMenuPanel/Scores/ScoreKittyz/Score").gameObject.GetComponent <Text> (); timeTxt = transform.Find("PauseMenuPanel/Scores/ScoreTime/Score").gameObject.GetComponent <Text> (); lifeTxt = transform.Find("PauseMenuPanel/Scores/ScoreLife/Score").gameObject.GetComponent <Text> (); scoreTxt = transform.Find("PauseMenuPanel/TotalScore").gameObject.GetComponent <Text> (); scoreLabelTxt = transform.Find("PauseMenuPanel/LabelScore").gameObject.GetComponent <Text> (); //GameOverPanel checkpointCountdown = transform.Find("GameOverPanel/Countdown/CheckpointCountdown").gameObject.GetComponent <Text> (); //Top/Bottom UI topUI = transform.Find("TopUI").gameObject; lifeBar = transform.Find("TopUI/LifeBar").gameObject; bottomUI = transform.Find("BottomUI").gameObject; //Targets targetKittyzTxt = transform.Find("PauseMenuPanel/Scores/ScoreKittyz/Target").gameObject.GetComponent <Text> (); targetTimeTxt = transform.Find("PauseMenuPanel/Scores/ScoreTime/Target").gameObject.GetComponent <Text> (); targetLifeTxt = transform.Find("PauseMenuPanel/Scores/ScoreLife/Target").gameObject.GetComponent <Text> (); //LevelTitle and difficulty GameObject levelTitle = transform.Find("LevelTitle").gameObject; GameObject levelDifficultyLabel = levelTitle.transform.Find("LevelDifficulty").gameObject; levelTitle.GetComponent <Text> ().text = level.GetFullName(); if (level.isStory) { levelDifficultyLabel.SetActive(false); } else { levelDifficultyLabel.GetComponent <Text>().text = LocalizationManager.Instance.GetText(level.difficulty.ToString()); } //Checkpoints checkpointController = GameObject.Find("CheckPointController"); //TipUI if (ApplicationController.ac.IsTipAlreadyConsulted(TipEnum.BUY_LIFE)) { Destroy(tipButton); Destroy(tipPanel); } //Obstacles obsGen = obsGenObj.GetComponent <ObstaclesGenerator>(); audioSource = GetComponent <AudioSource> (); CreateInterstitial(); }
// Start is called before the first frame update void Start() { obstaclesGenerator = GameObject.Find("ObstaclesGenerator").GetComponent <ObstaclesGenerator>(); /* * //adjust resolution as screen flips * if(screenWidth == Screen.width || screenHeight == Screen.height) * { * screenHeight = Screen.width - (640 * 2); * screenWidth = Screen.height - (360 * 2); * Screen.SetResolution(screenWidth, screenHeight, true); * }*/ }
// Use this for initialization IEnumerator Start() { AudioSource audio = GetComponent <AudioSource>(); audio.clip = introMusic; audio.Play(); yield return(new WaitForSeconds(10)); // Destroy fence audio.clip = destroySound; audio.Play(); GameObject fence = GameObject.Find("MainFrontFence"); Destroy(fence); yield return(new WaitForSeconds(audio.clip.length - 0.5f)); // Start game! CameraMover moverScript = GetComponent <CameraMover>(); moverScript.enabled = true; ObstaclesGenerator obstaclesScript = GetComponent <ObstaclesGenerator>(); obstaclesScript.enabled = true; GameObject.Find("IntroText").GetComponent <Text>().enabled = true; GameObject.Find("ScoreText").GetComponent <Text>().enabled = true; audio.clip = gameMusic; audio.Play(); audio.time = 27; yield return(new WaitForSeconds(4)); GameObject.Find("IntroText").GetComponent <Text>().enabled = false; }
// Start is called before the first frame update void Start() { instance = this; gameOverText.SetActive(false); gameRestartText.SetActive(false); }