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 }
public void SetCurrentState(FSMState <T> state) { if (m_CurrentState == state) { Log.w("FSM:Set Same State"); } if (state == null) { return; } if (m_CurrentState != null) { m_CurrentState.Exit(m_Entity); m_PreviousState = m_CurrentState; } m_CurrentState = state; m_CurrentState.Enter(m_Entity); Log.i("StateChange:{0}->{1}", m_PreviousState, m_CurrentState); }
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 }