Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (GameState == eGameState.Game_Over && !gameOverInput)
        {
            gameOverTimer += Time.deltaTime;
            if (gameOverTimer >= gameOverWait)
            {
                gameOverInput = true;
            }
        }

        if (gameOverInput && GameState != eGameState.Game_Over)
        {
            gameOverInput = false;
        }

        string currentScene = ScreenChanger.GetActiveScene().name;

        if (GameState == eGameState.Game_Win && currentScene == ScreenChanger.TitleScene)
        {
            GameState = eGameState.Initial;
        }

        if (InputManager.GetAnyButtonDown())
        {
            if (currentScene == ScreenChanger.IntroScene || (GameState == eGameState.Game_Over && gameOverInput))
            {
                GameState = eGameState.Initial;
                ScreenChanger.LoadNewScene(ScreenChanger.TitleScene);
            }
            else if (currentScene == ScreenChanger.TitleScene)
            {
                GameState = eGameState.OverWorld;
                ScreenChanger.LoadNewScene(ScreenChanger.TDScene);
            }
        }

        if (InputManager.PowerOff())
        {
            Poweroff.SetActive(true);
        }
    }