e1a5470147a01e5116b013d671ccdabb18a97fab.js 2.1 KB

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