private void ChangeState(IState <T> nextState) { if (m_CurState != null) { m_CurState.OnExitState(); } if (nextState != null) { m_CurState = nextState; m_CurState.OnEnterState(); } }
/// <summary> /// 进行状态过渡 /// </summary> /// <param name="transition"></param> private void DoTransition(ITransition transition) { _currentState.OnExitState(); _currentState = transition.ToState; _currentState.OnEnterState(); }