void Update()
    {
        secondTimer += Time.deltaTime;
        if (secondTimer > 1)
        {
            secondTimer = 0;
            timerSound.Play();
        }



        TimeLeft -= Time.deltaTime;
        float tempTime = TimeLeft;
        int   minutes  = (int)tempTime / 60;
        int   seconds  = (int)tempTime % 60;

        timer.text = minutes.ToString() + ":" + seconds.ToString();
        if (TimeLeft < 0)
        {
            gameOver.EndGame();
            GameObject.Destroy(gameObject);
        }
    }
Exemple #2
0
 void OnDestroy()
 {
     gameOver.EndGame();
 }