Пример #1
0
    // update 等待 行为
    private void UpdateWaitBehavior()
    {
        var        priority = -1;
        UNBehavior behavior = null;

        for (int i = 0; i < m_behaviorsWaitForExecute.Count; ++i)
        {
            if (!m_behaviorsWaitForExecute[i].CanChangeToState(UNBehaviorStateType.Execute))
            {
                continue;
            }
            if (priority < m_behaviorsWaitForExecute[i].m_priority)
            {
                behavior = m_behaviorsWaitForExecute[i];
                priority = m_behaviorsWaitForExecute[i].m_priority;
            }
        }
        m_behaviorsWaitForExecute.Clear();
        if (behavior.IsNull())
        {
            return;
        }
        m_curBehavior = behavior;
        m_curBehavior.ChangeToState(UNBehaviorStateType.Execute);
    }
Пример #2
0
 protected void UpdateBehaviors()
 {
     if (m_curBehavior.IsNull())
     {
         UpdateWaitBehavior();
     }
     else
     {
         if (m_curBehavior.m_curState == UNBehaviorStateType.Finish)
         {
             UpdateNewBehavior();
         }
         else
         {
             UpdateCurBehavior();
         }
     }
 }