public void ChangeState(FSMState <EntityType, TransitionId> NewState) { if (m_CurrentState != NewState) { m_PreviousState = m_CurrentState; if (m_CurrentState != null) { m_CurrentState.Exit(); } m_CurrentState = NewState; if (m_CurrentState != null) { m_CurrentState.Enter(); } } }
/*设置全局状态*/ public void SetGlobalState(FSMState <EntityType, TransitionId> globalState) { m_GlobalState = globalState; m_GlobalState.Enter(); }
/*设置当前状态*/ public void SetCurrentState(FSMState <EntityType, TransitionId> currentState) { m_CurrentState = currentState; m_CurrentState.Enter(); }
/*进入全局状态*/ public void GlobalStateEnter() { m_GlobalState.Enter(); }