MemParallel.js 1012 B

1234567891011121314151617181920212223242526272829
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0});
  5. const s = t("Actions"),
  6. a = t("constants"),
  7. o = t("Composite");
  8. class n extends o.default {
  9. constructor(t = {}) {
  10. super({name: "MemParallel", children: t.children, properties: t.properties, title: t.title || t.name});
  11. }
  12. open(t) {
  13. t.blackboard.set("runningChild", 0, t.tree.id, this.id);
  14. }
  15. tick(t) {
  16. let e = !1,
  17. i = !1;
  18. for (var s = t.blackboard.get("runningChild", t.tree.id, this.id); s < this.children.length; s++) {
  19. var o = this.children[s]._execute(t);
  20. if (o === a.SUCCESS) e = !0;
  21. else {
  22. if (o !== a.FAILURE) return t.blackboard.set("runningChild", s, t.tree.id, this.id), o;
  23. i = !0;
  24. }
  25. }
  26. return 0 === this.properties.type ? (e ? a.SUCCESS : a.FAILURE) : i ? a.FAILURE : a.SUCCESS;
  27. }
  28. }
  29. (i.default = n), s.register(n, "MemParallel");