コード例 #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;
 }