Exemplo n.º 1
0
    public void SetCurrentGameState(GameState gameState)
    {
        switch (gameState)
        {
        case GameState.MAIN_MENU:
            //init all values
            // SceneManager.LoadScene(0);
            StartCoroutine(transitionLoader.LoadScene(0));
            if (player != null)
            {
                player.SetActive(false);
            }
            break;

        case GameState.TUTORIAL:
            transitionLoader.LoadScene();
            if (player != null)
            {
                player.SetActive(true);
            }
            player.transform.position = new Vector2(0, 0);
            break;

        case GameState.IN_GAME:
            //  SceneManager.LoadScene(2);
            StartCoroutine(transitionLoader.LoadScene(2));
            if (player != null)
            {
                player.SetActive(true);
            }
            player.transform.position = new Vector2(0, 0);
            //add index if more levels, load each level

            break;

        case GameState.GAME_OVER:
            SceneManager.LoadScene(3);
            if (player != null)
            {
                player.SetActive(false);
            }
            break;
        }
    }