123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- var t = require;
- var e = module;
- var i = exports;
- var o,
- e =
- (this && this.__decorate) ||
- function (t, e, i, s) {
- var o,
- a = arguments.length,
- n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
- else
- for (var r = t.length - 1; 0 <= r; r--)
- (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
- return 3 < a && n && Object.defineProperty(e, i, n), n;
- };
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("DeskService"),
- a = t("OrderService"),
- n = t("RoleService"),
- r = t("BaseMan"),
- l = t("Car"),
- h = t("OrderDisplay"),
- c = t("MoveComponent");
- ((t = o = o || {})[(t.NONE = 0)] = "NONE"),
- (t[(t.MOVE_TO_ORDER = 1)] = "MOVE_TO_ORDER"),
- (t[(t.WAIT_ORDER = 2)] = "WAIT_ORDER"),
- (t[(t.WAIT_FOOD = 3)] = "WAIT_FOOD"),
- (t[(t.MOVE_TO_FRONT = 4)] = "MOVE_TO_FRONT"),
- (t[(t.MOVE_TO_EXIT = 5)] = "MOVE_TO_EXIT");
- var {ccclass: t} = cc._decorator,
- t = e(
- [t],
- (t = class extends cc.Component {
- constructor() {
- super(...arguments), (this.man = null), (this.move = null), (this.state = o.NONE), (this.curIndex = -1);
- }
- onLoad() {
- (n.default.ins.canCreateCar = !1),
- (this.man = this.getComponent(l.default)),
- (this.move = this.getComponent(c.default));
- }
- log(...t) {
- cc.log("CarAI", ...t);
- }
- update(t) {
- if (this.man.state === r.CharactorState.stand)
- switch (this.state) {
- case o.WAIT_ORDER:
- case o.WAIT_FOOD:
- this.man.isEixt &&
- ((this.state = o.MOVE_TO_EXIT),
- n.default.ins.cars.remove(this.man),
- this.move.moveTo(n.default.ins.exit),
- (this.man.posData = null));
- break;
- case o.MOVE_TO_FRONT:
- 0 === this.curIndex
- ? ((this.man.isReadyReceive = !0),
- (this.state = o.WAIT_FOOD),
- s.default.ins.carCookDataFinish(this.man))
- : n.default.ins.cars.indexOf(this.man) !== this.curIndex &&
- ((this.curIndex = n.default.ins.cars.indexOf(this.man)),
- this.move.moveTo(this.man.carPosData.receiveTrans[this.curIndex]));
- break;
- case o.NONE:
- (this.state = o.MOVE_TO_ORDER), this.move.moveTo(this.man.carPosData.order);
- break;
- case o.MOVE_TO_ORDER:
- a.default.ins.waitOrderList.push({
- target: this,
- cb: this.orderFinish,
- pos: this.man.carPosData.staffTrans.pos,
- direction: this.man.carPosData.staffTrans.direction
- }),
- (this.state = o.WAIT_ORDER);
- break;
- case o.MOVE_TO_EXIT:
- this.man.destroySelf();
- }
- }
- orderFinish() {
- n.default.ins.canCreateCar = !0;
- const e = a.default.ins.createOrders(4),
- i = e.length;
- for (let t = 0; t < i; t++) {
- const i = e[t];
- this.man.orders.push(i);
- const s = a.default.ins.orderPool.pop();
- (s.x = s.y = 0),
- this.man.orderNode.children[t].addChild(s),
- (i.display = s.getComponent(h.default)),
- i.display || (i.display = s.addComponent(h.default)),
- (i.customer = this.man),
- i.display.setData(i);
- }
- (this.curIndex = n.default.ins.cars.indexOf(this.man)),
- this.move.moveTo(this.man.carPosData.receiveTrans[this.curIndex]),
- (this.state = o.MOVE_TO_FRONT);
- }
- })
- );
- i.default = t;
|