コード例 #1
0
 void OnDestroy()
 {
     if (_root != null)
     {
         _root.Clear();
     }
 }
コード例 #2
0
ファイル: BTTree.cs プロジェクト: cyulei/NewbieZone
 /// <summary>
 /// 重置根节点
 /// </summary>
 protected void Reset()
 {
     if (root != null)
     {
         root.Clear();
     }
 }
コード例 #3
0
ファイル: RemoteTree.cs プロジェクト: DongerGroup/FrameSync-1
 public override void Clear()
 {
     if (m_cChild != null)
     {
         m_cChild.Clear();
     }
 }
コード例 #4
0
ファイル: BTSequence.cs プロジェクト: cyulei/NewbieZone
 protected override bool DoEvaluate()
 {
     if (activeChild != null)
     {
         bool result = activeChild.Evaluate();
         // 节点之间与关系 一个不能执行则后面不执行
         if (!result)
         {
             activeChild.Clear();
             activeChild = null;
             activeIndex = -1;
         }
         return(result);
     }
     else
     {
         //Debug.Log(children[0]);
         return(children[0].Evaluate());
     }
 }
コード例 #5
0
    /// <summary>
    /// 判断能否执行该节点
    /// </summary>
    /// <returns></returns>
    protected override bool DoEvaluate()
    {
        // 孩子节点中至少有一个可以执行
        foreach (BTNode child in children)
        {
            if (child.Evaluate())
            {
                if (activeChild != null && activeChild != child)
                {
                    activeChild.Clear();
                }
                activeChild = child;
                return(true);
            }
        }

        // 否则不进行选择
        if (activeChild != null)
        {
            activeChild.Clear();
            activeChild = null;
        }
        return(false);
    }
コード例 #6
0
 protected override void Exit()
 {
     child.Clear();
 }