示例#1
0
        protected CStateBase GetState(int stateID)
        {
            CStateBase state = null;

            m_stateDict.TryGetValue(stateID, out state);
            return(state);
        }
示例#2
0
        public void SetCurrentState(int stateID)
        {
            var targetState = GetState(stateID);

            if (null == targetState)
            {
                //no target state, do nothing.
                return;
            }
            if (m_curretState != null)
            {
                m_curretState.OnExitState();
            }
            m_curretState = targetState;
            if (null != m_curretState)
            {
                m_curretState.OnEnterState();
            }
        }
示例#3
0
 public void Clear()
 {
     m_stateDict.Clear();
     m_stateDict   = null;
     m_curretState = null;
 }
示例#4
0
 public void AddState(CStateBase state)
 {
     m_stateDict.Add(state.StateID, state);
 }
示例#5
0
 public CFSMMgr()
 {
     m_stateDict   = new Dictionary <int, CStateBase>(4);
     m_curretState = null;
 }