Exemple #1
0
        public override bool DoEvaluate()
        {
            foreach (BTNode _node in children)
            {
                if (_node.Evaluate())
                {
                    if (activeChild != null && activeChild != _node)
                    {
                        activeChild.Reset();
                    }

                    activeChild = _node;

                    return(true);
                }
            }

            if (activeChild != null)
            {
                activeChild.Reset();
                activeChild = null;
            }

            return(false);
        }
Exemple #2
0
 public override bool DoEvaluate()
 {
     if (activeChild != null)
     {
         bool _res = activeChild.Evaluate();
         if (!_res)
         {
             activeChild.Reset();
             activeChild = null;
             activeIndex = -1;
         }
         return(_res);
     }
     else
     {
         return(children[0].Evaluate());
     }
 }