예제 #1
0
 void Freeze()
 {
     FreezeMenu.GetFreezeMenu().FreezeScreen();
     AudioManager.GetInstance().DesacelerateSfx();
     CountdownTimer.getInstance().CountTo(time_slow_down);
     Store.GetInstance().SpeedAnimation();
     MenuController.GetInstance().SpeedAnimation();
     Player.getInstance().GetPlayerMovement().SpeedAnimation();
     Destroy(gameObject);
 }
예제 #2
0
    void Update()
    {
        if (!isRunning)
        {
            return;
        }

        if (countTo > 0)
        {
            countTo            -= 1 * Time.unscaledDeltaTime;
            timer_minutes.color = new Color32(161, 0, 255, 255);
            timer_seconds.color = new Color32(161, 0, 255, 255);

            if (countTo > 0)
            {
                timer_minutes.text = "0";
                timer_seconds.text = Mathf.FloorToInt(countTo).ToString();
            }

            if (countTo > 0 && countTo < 0.5)
            {
                AudioManager.GetInstance().AcelerateSfx();
                FreezeMenu.GetFreezeMenu().UnfreezeScreen();
                Store.GetInstance().NormalizeAnimation();
                MenuController.GetInstance().NormalizeAnimation();
                Player.getInstance().GetPlayerMovement().NormalizeAnimation();
                Time.timeScale = 1;
            }
            return;
        }

        if (timer_minutes.color.Equals(new Color32(161, 0, 255, 255)))
        {
            timer_minutes.color = new Color32(161, 161, 161, 255);
            timer_seconds.color = new Color32(161, 161, 161, 255);
        }

        if (isCompleted)
        {
            GameManager.GetInstance().GameOver("nova_aerea");
            return;
        }

        currentSeconds -= 1 * Time.unscaledDeltaTime;
        int sec = Mathf.FloorToInt(currentSeconds);

        if (currentSeconds <= 0 && currentMinutes == 0)
        {
            isCompleted = true;
            return;
        }

        timer_minutes.text = (currentMinutes > 0?"0":"") + currentMinutes;
        timer_seconds.text = (sec > 9?sec + "":("0" + sec));

        if (currentSeconds <= 0 && currentMinutes != 0)
        {
            currentSeconds = 60;
            currentMinutes--;
        }
    }