Ejemplo n.º 1
0
        public void SetGlobalState(FSMState <T> state, params object[] args)
        {
            if (m_GlobalState != null)
            {
                m_GlobalState.Exit(m_Entity);
            }

            m_GlobalState = state;

            if (m_GlobalState != null)
            {
                m_GlobalState.DoEnter(m_Entity, args);
            }

            //#if UNITY_EDITOR
            OnGlobalStateChange();
            //#endif
        }
Ejemplo n.º 2
0
        public void SetCurrentState(FSMState <T> state, params object[] args)
        {
            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 UNITY_EDITOR
            if (m_CurrentState != null)
            {
                if (m_PreviousState == null)
                {
                    Log.i("{0} State:{1}", m_Entity, m_CurrentState.stateName);
                }
                else
                {
                    Log.i("{0} State:{1}->{2}", m_Entity, m_PreviousState.stateName, m_CurrentState.stateName);
                }
            }
#endif

            if (m_CurrentState != null)
            {
                m_CurrentState.DoEnter(m_Entity, args);
            }

            //#if UNITY_EDITOR
            OnCurrentStateChange();
            OnPreviousStateChange();
            //#endif
        }