void Update() { if (isGameActive) { // Update timer if (lifetime <= 0) { Destroy(gameObject); } else { lifetime -= Time.deltaTime; } // Update movement Vector2 position = transform.position; position += direction * moveSpeed * Time.deltaTime; transform.position = position; } else { float postGameSeconds = GameTimeManager.GetInstance().finishTimeSeconds; float currentSeconds = GameTimeManager.GetInstance().GetCurrentGameTime(); transform.localScale = initialScale * (1 - (postGameSeconds - currentSeconds) / postGameSeconds); } }
void Update() { float gameTimeSeconds = Mathf.Ceil(GameTimeManager.GetInstance().GetCurrentGameTime()); int secondsLeft = (int)(gameTimeSeconds) % 60; int minutesLeft = (int)(gameTimeSeconds) / 60; if (GameTimeManager.GetInstance().GetGameState() == GAMESTATE.postgame) { timerText.text = "00:00"; } else { timerText.text = minutesLeft.ToString("00") + ":" + secondsLeft.ToString("00"); } }