public static void Reset(int fromIndex, INodeBlob blob, IBlackboard bb, int count = 1)
 {
     blob.ResetStates(fromIndex, count);
     blob.ResetRuntimeData(fromIndex, count);
     for (var i = fromIndex; i < fromIndex + count; i++)
     {
         var typeId = blob.GetTypeId(i);
         _RESETS[typeId](i, blob, bb);
     }
 }
Exemple #2
0
 public static void Reset(int fromIndex, INodeBlob blob, IBlackboard bb, int count = 1)
 {
     blob.ResetStates(fromIndex, count);
     blob.ResetRuntimeData(fromIndex, count);
     for (var i = fromIndex; i < fromIndex + count; i++)
     {
         var typeId = blob.GetTypeId(i);
         var ptr    = blob.GetRuntimeDataPtr(i);
         MetaNodeRegister.NODES[typeId].Reset.Invoke(ptr, i, blob, bb);
     }
 }
Exemple #3
0
        public static NodeState Tick(int index, INodeBlob blob, IBlackboard bb)
        {
            var endIndex   = blob.GetEndIndex(index);
            var childIndex = index + 1;

            for (var i = childIndex + 1 /* always reset directly child */; i < endIndex; i++)
            {
                if (blob.GetState(i) == NodeState.Running)
                {
                    endIndex = i;
                    break;
                }
            }
            var count = endIndex - childIndex;

            // count will be 0 if there's no child
            blob.ResetStates(childIndex, count);
            return(blob.TickChildren(index, bb).FirstOrDefault());
        }