123456789101112131415161718192021222324 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("constants"),
- o = t("Decorator");
- i.default = class extends o.default {
- constructor({maxLoop: t = -1, child: e = null} = {}) {
- super({child: e, name: "Repeater", title: "Repeat <maxLoop>x", properties: {maxLoop: -1}}), (this.maxLoop = t);
- }
- open(t) {
- t.blackboard.set("i", 0, t.tree.id, this.id);
- }
- tick(t) {
- if (!this.child) return s.ERROR;
- for (
- var e = t.blackboard.get("i", t.tree.id, this.id), i = s.SUCCESS;
- (this.maxLoop < 0 || e < this.maxLoop) && ((i = this.child._execute(t)) == s.SUCCESS || i == s.FAILURE);
- )
- e++;
- return t.blackboard.set("i", e, t.tree.id, this.id), i;
- }
- };
|