public bool HasConsequence(enumEvents _event) { if (consequences != null) { return(consequences.ContainsKey(_event)); } return(false); }
public static void InvokeEvent(enumEvents _event) { Debug.Log("FSMLog - invoking event " + _event.ToString()); if (currentState.HasConsequence(_event)) { if (currentState.exit != null) { currentState.exit(); } enumStates nextState = currentState.NextState(_event); var query = AllStates.Where(a => a.fsmState == nextState); currentState = stateFsmFromEnumState(nextState); if (currentState.enter != null) { currentState.enter(); } Debug.Log("FSMLog - Entering state " + currentState.fsmState.ToString()); } else { Debug.Log("FSMERROR - state " + currentState.fsmState + " has no consequence for the event " + _event); } // StateFSM tempState ; }
public void AddConsequence(enumEvents _fsmEvent, enumStates _nextFsmState) { consequences.Add(_fsmEvent, _nextFsmState); }
public enumStates NextState(enumEvents _event) { return(consequences[_event]); }
public static void AddEventConsequence(enumStates _fromState, enumEvents _event, enumStates _toState) { stateFsmFromEnumState(_fromState).AddConsequence(_event, _toState); }