public GetOutputState ( Transition, trans ) : StateID | ||
trans | Transition, | |
return | StateID |
public StateID GetOutputState(Transition trans)
{
// Check if the map has this transition
if (map.ContainsKey(trans))
{
return map[trans];
}
return StateID.STS_NONE;
}
public void PerformTransition(Transition trans) { if (trans == Transition.None) { Debug.LogError("FSM ERROR: Null transition is not allowed"); return; } FSMStateID id = currentState.GetOutputState(trans); if (id == FSMStateID.None) { Debug.LogError("FSM ERROR: Current State does not have a target state for this transition"); return; } currentStateID = id; foreach (FSMState state in fsmStates) { if (state.ID == currentStateID) { currentState = state; break; } } }