Пример #1
0
    IEnumerator StartTimer()
    {
        while (!isGameOver)
        {
            yield return(new WaitForSeconds(1));

            seconds++;
            string leadingH = seconds / 60 > 9 ? "" : "0";
            string leadings = seconds % 60 > 9 ? "" : "0";
            clockText.text = $"{leadingH}{seconds / 60}:{leadings}{seconds % 60}";

            if (seconds - lastSecondDifficulty > timeBetwenDifficultyUp)
            {
                gen.Hardeeer();
                lastSecondDifficulty = seconds;
                if (!isGameOver)
                {
                    gameOverText.text = "DIFFICULTY UP";
                }
                StartCoroutine(ResetMessage());
            }
        }
    }