private void Init( ) { //get ref _instance = this; //panel GamePausePanel = GamePausePanel ?? gameObject.transform.Find("GamePausePanel").gameObject; InGamePanel = InGamePanel ?? gameObject.transform.Find("InGamePanel").gameObject; GameOverPanel = GameOverPanel ?? gameObject.transform.Find("GameOverPanel").gameObject; //text _timeLeftText = _timeLeftText ?? InGamePanel.transform.Find("Img_TimeLeft").GetComponentInChildren <Text>(); _userScore = _userScore ?? InGamePanel.transform.Find("Img_Score").GetComponentInChildren <Text>(); _congratsText = _congratsText ?? InGamePanel.transform.Find("Txt_Congrats").GetComponent <Text>(); _countDownText = _countDownText ?? InGamePanel.transform.Find("Txt_CountDown").GetComponent <Text>(); _countdownRectTransform = _countDownText.GetComponent <RectTransform>(); GamePausePanel.SetActive(false); GameOverPanel.SetActive(false); InGamePanel.SetActive(true); }
private void OnDestroy( ) { _instance = null; }