Example #1
0
 public void EnableFSM()
 {
     //m_bActive = true;
     foreach (FSMState state in m_dicStates.Values)
     {
         state.OnAwake();
         if (state.IsDefault())
         {
             m_curState = state;
         }
     }
     m_curState.OnEnter();
 }
Example #2
0
        public void TryEnterState(int id)
        {
            if (!m_bInit || m_bSwitchState)
            {
                return;
            }

            if (id == m_curState.id)
            {
                return;
            }

            FSMState state;

            if (m_dicStates.TryGetValue(id, out state))
            {
                m_bSwitchState = true;
                m_curState.OnExit();
                m_curState = state;
                m_curState.OnEnter();
                m_bSwitchState = false;
            }
        }