1e1e6230-89b8-4440-a389-3d2c9471966f.js
3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"use strict";
cc._RF.push(module, '1e1e6IwibhEQKOJPSyUcZZv', 'LaserObj');
// scripts/kernel/battle/map/LaserObj.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.LaserObj = void 0;
var SoundManager_1 = require("../../../component/SoundManager");
var Global_1 = require("../../../Global");
var BattleConst_1 = require("../BattleConst");
var ObjData_1 = require("./ObjData");
var LaserObj = /** @class */ (function (_super) {
__extends(LaserObj, _super);
function LaserObj() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._dir = BattleConst_1.LASER_DIR.NONE;
return _this;
//#endregion
//#region private method
//#endregion
}
Object.defineProperty(LaserObj.prototype, "dir", {
get: function () { return this._dir; },
enumerable: false,
configurable: true
});
//#region life cycle
LaserObj.prototype.init = function (map, type, gridX, gridY) {
_super.prototype.init.call(this, map, type, gridX, gridY);
if (type == BattleConst_1.ObjType.LANCER_1) {
this._dir = BattleConst_1.LASER_DIR.VERTICAL;
this._imgName = 'UI_yxz_tsfk_jg1';
}
else if (type == BattleConst_1.ObjType.LANCER_2) {
this._dir = BattleConst_1.LASER_DIR.HORIZEN;
this._imgName = 'UI_yxz_tsfk_jg2';
}
else if (type == BattleConst_1.ObjType.LANCER_3) {
this._dir = BattleConst_1.LASER_DIR.COMBINE;
this._imgName = 'UI_yxz_tsfk_jg3';
}
};
LaserObj.prototype.clone = function () {
return this.cloneValue(new LaserObj());
};
LaserObj.prototype.cloneValue = function (target) {
_super.prototype.cloneValue.call(this, target);
target._dir = this._dir;
return target;
};
//#endregion
//#region public method
//#endregion
//#region event
LaserObj.prototype.onCollisonToBall = function (collider) {
_super.prototype.onCollisonToBall.call(this, collider);
this.map.battle.addToRoundClear(this);
if (this._dir == BattleConst_1.LASER_DIR.HORIZEN || this._dir == BattleConst_1.LASER_DIR.COMBINE) {
for (var x = 0; x < this.map.mapGridSize.x; ++x) {
var block = this.map.getBlockByGridPos(x, this.gridPos.y);
if (block) {
block.onCollisonToBall(null);
// if (block instanceof RectBlockData) {
// // block.widthGrid
// x += (block.widthGrid - 1); //跳过宽度
// }
}
}
}
if (this._dir == BattleConst_1.LASER_DIR.VERTICAL || this._dir == BattleConst_1.LASER_DIR.COMBINE) {
for (var y = 0; y < this.map.mapGridSize.y; ++y) {
var block = this.map.getBlockByGridPos(this.gridPos.x, y);
if (block) {
block.onCollisonToBall(null);
// if (block instanceof RectBlockData) {
// // block.widthGrid
// y += (block.heightGrid - 1); //跳过宽度
// }
}
}
}
SoundManager_1.SoundManager.ins.playEffect(Global_1.SoundName.RAZER);
};
return LaserObj;
}(ObjData_1.ObjData));
exports.LaserObj = LaserObj;
cc._RF.pop();