123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- var t = require;
- var e = module;
- var i = exports;
- var s =
- (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 { ccclass: o, property: a, menu: n } = cc._decorator;
- e = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.huawen_1 = null),
- (this.huawen_2 = null),
- (this.targetPos = null),
- (this.originPos = null),
- (this.speed = 50),
- (this.nomal = null);
- }
- onLoad() {
- this.nomal = this.targetPos.sub(this.originPos).normalize();
- }
- update(t) {
- (this.huawen_1.x += t * this.speed * this.nomal.x),
- (this.huawen_1.y += t * this.speed * this.nomal.y),
- (this.huawen_2.x += t * this.speed * this.nomal.x),
- (this.huawen_2.y += t * this.speed * this.nomal.y),
- this.huawen_1.x > this.targetPos.x && (this.huawen_1.position = this.originPos),
- this.huawen_2.x > this.targetPos.x && (this.huawen_2.position = this.originPos);
- }
- onTouchClose() {
- (this.huawen_1.active = !1), (this.huawen_2.active = !1);
- }
- };
- s([a(cc.Node)], e.prototype, "huawen_1", void 0),
- s([a(cc.Node)], e.prototype, "huawen_2", void 0),
- s([a(cc.Vec2)], e.prototype, "targetPos", void 0),
- s([a(cc.Vec2)], e.prototype, "originPos", void 0),
- (e = s([o], e)),
- (i.default = e);
|