protected override bool DoEvaluate()
        {
            int numActiveChildren = 0;

            for (int i = 0; i < children.Count; i++)
            {
                BTNode child = children[i];
                if (child.Evaluate())
                {
                    _activeList[i] = true;
                    numActiveChildren++;
                }
                else
                {
                    _activeList[i] = false;
                }
            }

            if (numActiveChildren == 0)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
 protected override bool DoEvaluate()
 {
     if (_activeChild != null)
     {
         bool result = _activeChild.Evaluate();
         if (!result)
         {
             _activeChild.Clear();
             _activeChild = null;
             _activeIndex = -1;
         }
         return(result);
     }
     else
     {
         return(children[0].Evaluate());
     }
 }