123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- var t = require;
- var e = module;
- var i = exports;
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("App");
- i.default = class {
- constructor() {
- (this.MAP = 0),
- (this.SPRITE = 1),
- (this.mapPoss = [new cc.Vec2(0, 3), new cc.Vec2(0, 0), new cc.Vec2(0, -2)]),
- (this.spritePoss = [new cc.Vec2(5, -5), new cc.Vec2(-5, 5), new cc.Vec2(5, 0)]),
- (this._shockLength = 0),
- (this._shockCount = 0),
- (this._rx = 0),
- (this._ry = 0),
- (this._type = 0),
- (this._repeatCount = 0);
- }
- destroy() {
- this.stop();
- }
- shock(t = 0, e = null, i = 3) {
- this._target ||
- ((this._type = t),
- (this._target = e),
- this._type == this.MAP
- ? ((this._shockPoss = this.mapPoss.concat()), (this._shockLength = this._shockPoss.length))
- : this._type == this.SPRITE &&
- ((this._shockPoss = this.spritePoss.concat()), (this._shockLength = this._shockPoss.length)),
- this.start(i));
- }
- start(t = 1) {
- (this.repeatCount = t),
- (this._shockCount = 0),
- this._target &&
- (this._type != this.MAP && (this._rx = this._target.x),
- (this._ry = this._target.y),
- s.default.TimerManager.doFrame(1, 0, this.onShockEnter, this));
- }
- stop() {
- this._target &&
- (this._type != this.MAP && (this._target.x = this._rx),
- (this._target.y = this._ry),
- s.default.TimerManager.remove(this.onShockEnter, this)),
- (this._target = null);
- }
- onShockEnter(t) {
- var e = this._shockLength * this._repeatCount;
- this._shockCount >= e
- ? this.stop()
- : ((e = this._shockCount % this._shockLength),
- (e = this._shockPoss[e]),
- this._target &&
- (this._type != this.MAP && (this._target.x = this._rx + e.x), (this._target.y = this._ry + e.y)),
- this._shockCount++);
- }
- get repeatCount() {
- return this._repeatCount;
- }
- set repeatCount(t) {
- this._repeatCount = t;
- }
- };
|