Not.cs 379 B

12345678910111213141516171819202122
  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 (children.Count != 1)
  13. {
  14. throw new Exception(string.Format("not node children count not eq 1: {0}", children.Count));
  15. }
  16. return !this.children[0].Run(blackBoard);
  17. }
  18. }
  19. }