Selector.cs 518 B

12345678910111213141516171819202122
  1. namespace BehaviorTree
  2. {
  3. [NodeAttribute(NodeType.Select, typeof(Selector))]
  4. public class Selector: Node
  5. {
  6. public Selector(NodeConfig config): base(config)
  7. {
  8. }
  9. public override bool Run(BlackBoard blackBoard)
  10. {
  11. foreach (var child in this.children)
  12. {
  13. if (child.Run(blackBoard))
  14. {
  15. return true;
  16. }
  17. }
  18. return false;
  19. }
  20. }
  21. }