public virtual void Shutdown() { if (m_registeredStates == null || m_registeredStates.Count <= 0) { return; } if (m_currentState != null) { m_currentState.ExitState(this, m_emptyStateID); } foreach (KeyValuePair <StateKey, IFsmState <StateKey> > kvp in m_registeredStates) { IFsmState <StateKey> thisState = GetStateById(kvp.Key); if (thisState == null) { continue; } thisState.ShutdownState(this); } m_registeredStates.Clear(); m_registeredStates = null; m_wasShutdown = true; Enable = false; }