Exemple #1
0
    private void ChangeState(GameState.GameStateType stateToChangeTo)
    {
        //Make Sure the new state was set up
        if (stateToChangeTo == GameState.GameStateType.NOT_SET)
        {
            UnityEngine.Debug.LogError("You Can't change to a state without setting the new state");
        }

        //pop the old one off
        stateMachine.Pop();

        //Create the New State based on the request
        switch (stateToChangeTo)
        {
        case GameState.GameStateType.SETUP_PLAYER:
        {
            SetupPlayerState setupState = new SetupPlayerState();
            setupState.game = this;
            stateMachine.Push(setupState);
        }
        break;
        }

        shouldChangeState = false;
    }
Exemple #2
0
    private void ChangeState(GameState.GameStateType stateToChangeTo)
    {
        //Make Sure the new state was set up
        if (stateToChangeTo == GameState.GameStateType.NOT_SET)
            UnityEngine.Debug.LogError("You Can't change to a state without setting the new state");

        //pop the old one off
        stateMachine.Pop();

        //Create the New State based on the request
        switch (stateToChangeTo)
        {
            case GameState.GameStateType.SETUP_PLAYER:
                {
                    SetupPlayerState setupState = new SetupPlayerState();
                    setupState.game = this;
                    stateMachine.Push(setupState);
                }
                break;
        }

        shouldChangeState = false;
    }