Ejemplo n.º 1
0
    /// <summary>
    /// 如果当前节点Tick结束,就继续下一个节点
    /// </summary>
    public override BtResult Tick()
    {
        if (m_curActiveChild == null)
        {
            m_curActiveChild = m_children[0];
            m_curActiveIndex = 0;
        }
        BtResult result = m_curActiveChild.Tick();

        if (result == BtResult.Ended)
        {
            m_curActiveIndex++;
            if (m_curActiveIndex >= m_children.Count)
            {
                m_curActiveChild.Clear();
                m_curActiveChild = null;
                m_curActiveIndex = -1;
            }
            else
            {
                m_curActiveChild.Clear();
                m_curActiveChild = m_children[m_curActiveIndex];
                result           = BtResult.Running;
            }
        }
        return(result);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 如果当前节点tick完成就清除
    /// </summary>
    public override BtResult Tick()
    {
        if (m_curActiveChild == null)
        {
            return(BtResult.Ended);
        }
        BtResult result = m_curActiveChild.Tick();

        if (result == BtResult.Ended)
        {
            m_curActiveChild.Clear();
            m_curActiveChild = null;
        }
        return(result);
    }
Ejemplo n.º 3
0
 public virtual void OnUpdate()
 {
     if (!m_bRunning)
     {
         return;
     }
     if (m_dataBase.GetData <bool>(m_reset))
     {
         Reset();
         m_dataBase.SetData <bool>(m_reset, false);
     }
     if (m_root.Evaluate())
     {
         m_root.Tick();
     }
 }