예제 #1
0
    public void LevelEndReached()
    {
        levelTimer.Pause();
        levelTimer.SaveToPlayerPrefs(currentLevelNumber);
        levelFinished = true;
        levelGui.SetActive(true);


        TurnOffAllMenuButtons();
        menuButton.SetActive(true);
        restartLevelButton.SetActive(true);

        nextLevelButton.SetActive(true);
        pauseButton.SetActive(false);


        levelEndTint.colorsToChangeTo = new Color[] { initalTintColor, new Color(0, 1, 0, 0.8f) };
        levelEndTint.SetFirstColor();
        levelEndTint.DoCompleteTransition();

        levelFinishedLogo.colorsToChangeTo = new Color[] { Color.yellow, Color.green };
        levelFinishedText.text             = "Level\n" + currentLevelNumber;
        levelFinishedLogo.DoCompleteTransition();

        Balloon.balloonPoppedCounter = 0;
        PlayerPrefs.SetInt("Level" + currentLevelNumber, 1);
    }
예제 #2
0
    void Update()
    {
        if (Time.time > lastSwitchTime + (isDanger ? SecondsInRed : SecondsInGreen))
        {
            lastSwitchTime = Time.time;
            colorChanger.DoCompleteTransition();
            isDanger = !isDanger;

            if (isDanger && playerIsIn)  // player is already in we should manually ill since trigger wont enterok
            {
                KillPlayer(FindObjectOfType <Player>());
            }
        }
    }
예제 #3
0
    public void PauseButtonClicked()
    {
        if (isPaused)
        {
            return;
        }
        pauseButton.SetActive(false);
        levelGui.gameObject.SetActive(true);
        TurnOffAllMenuButtons();
        Time.timeScale = 0;

        menuButton.SetActive(true);
        resumeButton.SetActive(true);
        restartLevelButton.SetActive(true);
        isPaused = true;

        levelFinishedText.text = "Level\n" + currentLevelNumber;

        levelEndTint.colorsToChangeTo = new Color[] { initalTintColor, new Color(0.8f, 1.0f, 0.5f, 0.5f) };
        levelEndTint.SetFirstColor();
        levelEndTint.DoCompleteTransition();

        levelTimer.Pause();
    }