Ejemplo n.º 1
0
 /// <summary>
 /// 退出某一个状态(机) by吴江
 /// </summary>
 /// <param name="_event"></param>
 /// <param name="_toEnter"></param>
 /// <param name="_toExit"></param>
 public void ExitStates(Event _event, State _toEnter, State _toExit)
 {
     _toExit.ExitAllStates(_event, _toEnter);
     if (machine != null && machine.logDebugInfo)
     {
         Debug.Log("FSM Debug: Exit State - " + _toExit.name + " at " + Time.time);
     }
     _toExit.OnExit(_toExit, _toEnter, _event);
     currentStates.Remove(_toExit);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 退出所有状态(机) by吴江
 /// </summary>
 /// <param name="_event"></param>
 /// <param name="_toEnter"></param>
 /// <param name="_toExit"></param>
 protected void ExitAllStates(Event _event, State _toEnter)
 {
     for (int i = 0; i < currentStates.Count; ++i)
     {
         State activeChild = currentStates[i];
         activeChild.ExitAllStates(_event, _toEnter);
         activeChild.OnExit(activeChild, _toEnter, _event);
         if (machine != null && machine.logDebugInfo)
         {
             Debug.Log("FSM Debug: Exit State - " + activeChild.name + " at " + Time.time);
         }
     }
     currentStates.Clear();
 }