public void transition(String stateName) { FiniteState state; if (myStates.TryGetValue(stateName, out state) == true) { if (myCurrentState != null) { myCurrentState.onExit(); } //Debug.print("AI: Transition to : {0}", stateName); myCurrentState = state; myCurrentState.onEntry(); } else { Error.print("Cannot transition to state {0}", stateName); } }
public void addState(FiniteState state) { state.machine = this; myStates[state.name] = state; }