Example #1
0
        public void SetCurrentState(FSMState <T> state)
        {
            if (state == m_CurrentState)
            {
                Log.i("Change To SameState!");
                return;
            }

            if (m_CurrentState != null)
            {
                m_CurrentState.Exit(m_Entity);
                m_PreviousState = m_CurrentState;
            }

            m_CurrentState = state;

            if (m_CurrentState != null)
            {
                m_CurrentState.Enter(m_Entity);
            }

            //#if UNITY_EDITOR
            OnCurrentStateChange();
            OnPreviousStateChange();
            //#endif
        }
Example #2
0
        public void SetGlobalState(FSMState <T> state)
        {
            if (m_GlobalState != null)
            {
                m_GlobalState.Exit(m_Entity);
            }

            m_GlobalState = state;

            if (m_GlobalState != null)
            {
                m_GlobalState.Enter(m_Entity);
            }

            //#if UNITY_EDITOR
            OnGlobalStateChange();
            //#endif
        }