void Awake() { if (gc != this) { gc = this; } }
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(); }
private void collected() { CityGameController cityGameControllerObj = GameObject.Find("GameController").GetComponent <CityGameController>(); if (cityGameControllerObj) { //cityGameControllerObj.checkPoint(); } PlatformGameController platformGameControllerObj = GameObject.Find("GameController").GetComponent <PlatformGameController>(); if (platformGameControllerObj) { platformGameControllerObj.checkpoint(); } Destroy(gameObject); }
private void collected() { CityGameController cityGameControllerObj = GameObject.Find("GameController").GetComponent <CityGameController>(); if (cityGameControllerObj) { cityGameControllerObj.addScore(); } PlatformGameController platformGameControllerObj = GameObject.Find("GameController").GetComponent <PlatformGameController>(); if (platformGameControllerObj) { platformGameControllerObj.addScore(); } Destroy(gameObject); }