//控制状态之间的转换 public void PerformTransition(Transition trans) { if (trans == Transition.NullTransition) { Debug.LogError("NullTransition is not allow for a real transition."); return; } StateID id = currentState.GetOutputState(trans); if (id == StateID.NullStateID) { Debug.Log("Transition is not to be happend!没有符合条件的转换"); return; } FSMState state; states.TryGetValue(id, out state); currentState.DoBefoteLeaving(); currentState = state; currentState.DoBeforeEntering(); }