示例#1
0
文件: FSM.cs 项目: etn215n/FSM
        /*-------------------------------------------------------------------------*/
        internal void SetState(StateID stateID)
        {
            foreach (FSMState state in stateList)
            {
                if (state.ID == stateID)
                {
                    currentState.OnStateExit();
                    lastState    = currentState;
                    currentState = state;
                    currentState.OnStateEnter();
                    return;
                }
            }

            Debug.Log("Invalid state or state does not belong to this FSM.");
        }