Пример #1
0
    /// <summary>
    /// Only used when counting down.
    /// </summary>
    void Update()
    {
        if (countingDown)
        {
            //Gets the current time.
            DateTime now = DateTime.Now;
            //Updates the visual text.
            unpauseCountdown.text = (int)((countTo - now).TotalSeconds + 1) + "";
            //No longer puased
            if (countTo.CompareTo(now) < 0)
            {
                //Unpause functionality.
                Time.timeScale = 1;
                countingDown   = false;
                unpauseCountdown.gameObject.SetActive(false);
                playerMove.enabled = true;

                // resume sound
                AkSoundEngine.WakeupFromSuspend();

                leftLight.Resume();
                rightLight.Resume();
            }
        }
        if (fadingIn)
        {
            timer += Time.deltaTime;
            Color temp = Color.Lerp(Color.clear, Color.white, timer / fadeInTime);
            multiplier.color       = temp;
            score.color            = temp;
            pauseButtonImage.color = temp;
            if (timer >= fadeInTime)
            {
                fadingIn = false;
                GameState._instance.ResetTimeSinceGameStarted();
                GameState._instance.SetGameOver(false);
            }
        }
    }