Пример #1
0
    public void Setup(FSMState state)
    {
        if (stateStack == null)
        {
            stateStack = new Stack <FSMState>();
        }

        stateStack.Clear();
        stateStack.Push(state);

        nowState  = state;
        nextState = null;
        nowState.BeginState();
        nowState.DoState();
    }
Пример #2
0
    public void UpdateFSM()
    {
        nowState.CheckTrans(this);

        if (nextState != null)
        {
            stateStack.Push(nextState);

            nowState.EndState();
            nowState = nextState;

            nextState = null;
            nowState.BeginState();
        }

        nowState.DoState();
    }