Esempio n. 1
0
    private void UpdateTimer()
    {
        if (timerRunning)
        {
            if (timeRemaining > 0)
            {
                timeRemaining -= Time.deltaTime;
            }
            else
            {
                timeRemaining   = 0;
                timerRunning    = false;
                InfoClass.Score = score.ToString();

                adManager.DestroyBannerView();
                //    adManager.ShowInterstitialAd();

                //    adManager.interstitialAd.OnAdClosed += LoadGameOverScene;

                SceneManager.LoadScene("GameOverScene");
            }

            // Change UI
            timeObject.GetComponent <TMP_Text>().text = Mathf.FloorToInt(timeRemaining % 60).ToString() + " s";

            if (timeRemaining <= 5)
            {
                ChangeTimerColor();
            }
        }
    }