protected CStateBase GetState(int stateID) { CStateBase state = null; m_stateDict.TryGetValue(stateID, out state); return(state); }
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(); } }
public void Clear() { m_stateDict.Clear(); m_stateDict = null; m_curretState = null; }
public void AddState(CStateBase state) { m_stateDict.Add(state.StateID, state); }
public CFSMMgr() { m_stateDict = new Dictionary <int, CStateBase>(4); m_curretState = null; }