void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void RefresTimerText() { LifeIncTimer lifeIncTimer = LifeIncTimer.Instance; InfiniteLifeTimer infiniteLifeTimer = InfiniteLifeTimer.Instance; if (timerText) { if (infiniteLifeTimer && infiniteLifeTimer.IsWork) { if (restHours != infiniteLifeTimer.RestHours || restMinutes != infiniteLifeTimer.RestMinutes || restSeconds != infiniteLifeTimer.RestSeconds) { restHours = infiniteLifeTimer.RestHours; restMinutes = infiniteLifeTimer.RestMinutes; restSeconds = infiniteLifeTimer.RestSeconds; timerText.text = restHours.ToString("00") + ":" + restMinutes.ToString("00") + ":" + restSeconds.ToString("00"); } if (lifesText.gameObject.activeSelf) { lifesText.gameObject.SetActive(false); } if (!infiniteIcon.gameObject.activeSelf) { infiniteIcon.gameObject.SetActive(true); } return; } if (lifeIncTimer) { if (restMinutes != lifeIncTimer.RestMinutes || restSeconds != lifeIncTimer.RestSeconds) { restMinutes = lifeIncTimer.RestMinutes; restSeconds = lifeIncTimer.RestSeconds; timerText.text = restMinutes.ToString("00") + ":" + restSeconds.ToString("00"); } if (!lifesText.gameObject.activeSelf) { lifesText.gameObject.SetActive(true); } if (infiniteIcon.gameObject.activeSelf) { infiniteIcon.gameObject.SetActive(false); } } } }