Пример #1
0
    public void AddState(FSMState s)
    {
        if (s == null)
        {
            return;
        }

        if (m_states.Count == 0)
        {
            m_states.Add(s);
            m_currentState = s;
            m_currentState.DoBeforeEnter(m_Data);
            m_currentStateID = s.m_StateID;
            return;
        }

        foreach (FSMState state in m_states)
        {
            if (state.m_StateID == s.m_StateID)
            {
                return;
            }
        }
        m_states.Add(s);
    }
Пример #2
0
 public void PerformGlobalTransition(eFSMTransition t)
 {
     if (m_GlobalMap.ContainsKey(t))
     {
         m_currentState.DoBeforeLeave(m_Data);
         m_currentState = m_GlobalMap[t];
         m_currentState.DoBeforeEnter(m_Data);
         m_currentStateID = m_currentState.m_StateID;
     }
 }
Пример #3
0
    public void PerformTransition(eFSMTransition trans)
    {
        if (trans == eFSMTransition.NullTransition)
        {
            return;
        }

        FSMState state = m_currentState.TransitionTo(trans);

        if (state == null)
        {
            return;
        }

        // Update the currentStateID and currentState
        m_currentState.DoBeforeLeave(m_Data);

        m_currentState   = state;
        m_currentStateID = state.m_StateID;
        m_currentState.DoBeforeEnter(m_Data);
    }