Ejemplo n.º 1
0
 void OnDestroy()
 {
     if (_root != null)
     {
         _root.Clear();
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 3
0
        protected override bool DoEvaluate()
        {
            for (int i = 0; i < children.Count; ++i)
            {
                BTNode child = children[i];
                if (child.Evaluate())
                {
                    if (_activeChild != null && _activeChild != child)
                    {
                        _activeChild.Clear();
                    }
                    _activeChild = child;
                    return(true);
                }
            }

            if (_activeChild != null)
            {
                _activeChild.Clear();
                _activeChild = null;
            }

            return(false);
        }