Example #1
0
File: FSM.cs Project: etn215n/FSM
        /*-------------------------------------------------------------------------*/
        public void Start()
        {
            if (stateList.Count == 0)
            {
                Debug.Log("There is no state in this FSM.");
                return;
            }

            currentState.OnStateEnter();
        }
Example #2
0
File: FSM.cs Project: 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.");
        }