예제 #1
0
 public override void OnChildComplete(Behavior sender, NodeStatus status)
 {
     // if the child return with success, we proceed to the next.
     if (status == NodeStatus.SUCCESS)
     {
         // if we have more, we move on.
         if (ChildIterator.MoveNext())
         {
             ChildIterator.Current.Enter();
         }
         // otherwise, we say that we have successfully completed all sequence, and exit with success.
         else
         {
             Exit(status);
         }
     }
     // if it failed, or is aborted, we exit and propagate the code.
     else
     {
         Exit(status);
     }
 }
예제 #2
0
 public override void OnChildComplete(Behavior sender, NodeStatus status)
 {
     // we exit as soon as our child returns successfully.
     if (status == NodeStatus.SUCCESS)
     {
         Exit(status); // same as decorators. Because the selector is not posted, we have to exit ourselves.
     }
     // we move to the next child if the previous one failed or is aborted.
     else
     {
         // if we have more, we enters our next child.
         if (ChildIterator.MoveNext())
         {
             ChildIterator.Current.Enter();
         }
         // if we don't have any left, we exit with failure.
         else
         {
             Exit(status);
         }
     }
 }