// ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ public void ExitStates(State _toEnter, State _toExit) { _toExit.ExitAllStates(_toEnter); if (machine != null && machine.logDebugInfo) { Debug.Log("FSM Debug: Exit State - " + _toExit.name + " at " + Time.time); } if (_toExit.onExit != null) { _toExit.onExit(_toExit, _toEnter); } currentStates.Remove(_toExit); }
// ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ protected void ExitAllStates(State _toEnter) { for (int i = 0; i < currentStates.Count; ++i) { State activeChild = currentStates[i]; activeChild.ExitAllStates(_toEnter); if (activeChild.onExit != null) { activeChild.onExit(activeChild, _toEnter); } if (machine != null && machine.logDebugInfo) { Debug.Log("FSM Debug: Exit State - " + activeChild.name + " at " + Time.time); } } currentStates.Clear(); }