"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();