Exemplo n.º 1
0
        protected override bool OnEvaluate(BTInput _input)
        {
            mCurrentSelectIndex = INVALID_CHILD_NODE_INDEX;

            int weight = -1;

            for (int i = 0; i < childCount; i++)
            {
                BTNode node = mChildren[i];
                if (node.Evaluate(_input))
                {
                    int w = node.GetWeight();
                    if (weight == -1 || w > weight)
                    {
                        weight = w;
                        mCurrentSelectIndex = i;
                    }
                }
            }
            if (CheckIndex(mCurrentSelectIndex))
            {
                return(true);
            }

            return(base.OnEvaluate(_input));
        }
Exemplo n.º 2
0
 protected override bool OnEvaluate(BTInput _input)
 {
     for (int i = 0; i < childCount; i++)
     {
         BTNode node = mChildren[i];
         if (mChildrenResults[i] == BTResult.Executing)
         {
             if (!node.Evaluate(_input))
             {
                 return(false);
             }
         }
     }
     return(true);
 }