Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (isTiming)
        {
            microSeconds += Time.deltaTime;

            if (microSeconds >= 1)
            {
                ++seconds;
                ++speedUpIncrement;
                microSeconds = 0.0f;
            }

            if (speedUpIncrement >= speedUpInterval)
            {
                speed.SpeedUp();
                speedUpIncrement = 0;

                Debug.Log("speed = interval");
            }

            if (seconds >= 60)
            {
                ++minutes;
                seconds = 0;
            }

            if (minutes < 10)
            {
                timerText.text = "0" + minutes + ":";
            }
            else
            {
                timerText.text = minutes + ":";
            }

            if (seconds < 10)
            {
                timerText.text += "0" + seconds;
            }
            else
            {
                timerText.text += seconds;
            }
        }
    }