Not.cs 536 B

1234567891011121314151617181920212223
  1. using System;
  2. namespace BehaviorTree
  3. {
  4. public class Not: Node
  5. {
  6. public Not(Config config)
  7. {
  8. this.Name = config.Name;
  9. }
  10. public override bool Run(BlackBoard blackBoard)
  11. {
  12. if (this.children.Count != 1)
  13. {
  14. throw new Exception(string.Format("not node children count not eq 1: {0}",
  15. this.children.Count));
  16. }
  17. return !this.children[0].Run(blackBoard);
  18. }
  19. }
  20. }