void OnTransitionEventTrigger(UnityEvent transitionEvent) { FsmState <T> targetState = fsmTable[currentState, transitionEvent]; if (targetState != null) { currentState.ExitState(); currentState = targetState; targetState.EnterState(); } }
public FiniteStateMachine(FsmState <T>[] states, UnityEvent[] transitionEvents, FsmState <T> entryState) { fsmTable = new Table <FsmState <T>, UnityEvent, FsmState <T> >(states, transitionEvents); currentState = entryState; currentState.EnterState(); }