098e262fff981f5b65eb1f31fe5a799ab0e6dc3c.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  2. "use strict";
  3. var _reporterNs, _cclegacy, BranchNode, Selector, _crd;
  4. function _reportPossibleCrUseOfBranchNode(extras) {
  5. _reporterNs.report("BranchNode", "./BranchNode", _context.meta, extras);
  6. }
  7. _export("Selector", void 0);
  8. return {
  9. setters: [function (_unresolved_) {
  10. _reporterNs = _unresolved_;
  11. }, function (_cc) {
  12. _cclegacy = _cc.cclegacy;
  13. }, function (_unresolved_2) {
  14. BranchNode = _unresolved_2.BranchNode;
  15. }],
  16. execute: function () {
  17. _crd = true;
  18. _cclegacy._RF.push({}, "90470XqT/FGHo/PRQktLcYy", "Selector", undefined);
  19. /*
  20. * @Author: dgflash
  21. * @Date: 2022-06-21 12:05:14
  22. * @LastEditors: dgflash
  23. * @LastEditTime: 2022-07-20 14:05:40
  24. */
  25. /**
  26. * 逻辑或关系
  27. * 只要子节点有一个返回true,则停止执行其它子节点,并且Selector返回true。如果所有子节点都返回false,则Selector返回false。
  28. */
  29. _export("Selector", Selector = class Selector extends (_crd && BranchNode === void 0 ? (_reportPossibleCrUseOfBranchNode({
  30. error: Error()
  31. }), BranchNode) : BranchNode) {
  32. success() {
  33. super.success();
  34. this._control.success();
  35. }
  36. fail() {
  37. super.fail();
  38. this._actualTask += 1;
  39. if (this._actualTask < this.children.length) {
  40. this._run(this._blackboard);
  41. } else {
  42. this._control.fail();
  43. }
  44. }
  45. _run(blackboard) {
  46. if (this._nodeRunning) {
  47. this._nodeRunning.run(this._blackboard);
  48. } else {
  49. super._run();
  50. }
  51. }
  52. });
  53. _cclegacy._RF.pop();
  54. _crd = false;
  55. }
  56. };
  57. });
  58. //# sourceMappingURL=098e262fff981f5b65eb1f31fe5a799ab0e6dc3c.js.map