protected void AddState(Enum _stateEnum, BaseFsmState _state) { if (m_states == null) { m_states = new Dictionary <Enum, BaseFsmState>(); } m_states.Add(_stateEnum, _state); }
public void EnterState(Enum _stateEnum) { if (m_currentCoroutine != null) { this.StopCoroutine(m_currentCoroutine);// All maybe we can terminate all? } if (m_state != null) { m_state.OnExit(); } m_stateEnum = _stateEnum; m_state = m_states[_stateEnum]; m_currentCoroutine = m_state.OnEnter(); this.StartCoroutine(m_currentCoroutine); }