//PRIVATE METHODS //INITIALIZE METHOD private void _initialize() { if (SceneManager.GetActiveScene().buildIndex == 3 || SceneManager.GetActiveScene().buildIndex == 2) { this._audioSources = gameObject.GetComponents <AudioSource>(); this._menuSound = this._audioSources[0]; } this._scoreTracker = GameObject.FindGameObjectWithTag("scoretracker"); this._scoreTrackerScript = this._scoreTracker.GetComponent <PersistantScore>(); this.ScoreValue = this._scoreTrackerScript.ScoreValue; this.LivesValue = this._scoreTrackerScript.LivesValue; this.GameoverText.enabled = false; this.HighScoreText.enabled = false; this.RestartButton.gameObject.SetActive(false); this.LevelButton.gameObject.SetActive(false); this.FinishGameText.enabled = false; if (this.PromoText != null) { this.PromoText.enabled = false; } if (this.GamePanel != null) { this.GamePanel.gameObject.SetActive(false); } }
// Use this for initialization void Start() { this._scoreTracker = GameObject.FindGameObjectWithTag("scoretracker"); this._scoreTrackerScript = this._scoreTracker.GetComponent <PersistantScore>(); this.HighScoreText.text = "Score : " + this._scoreTrackerScript.ScoreValue; }