f290c071-4624-4d9f-ae8f-c60df25636ca.js 2.47 KB
"use strict";
cc._RF.push(module, 'f290cBxRiRNn66Pxg3yVjbK', 'BlockSkillBomb');
// scripts/kernel/battle/map/blockSkill/BlockSkillBomb.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.BlockSkillBomb = void 0;
var SoundManager_1 = require("../../../../component/SoundManager");
var Global_1 = require("../../../../Global");
var BattleConst_1 = require("../../BattleConst");
var BlockSkillBase_1 = require("./BlockSkillBase");
var BlockSkillBomb = /** @class */ (function (_super) {
    __extends(BlockSkillBomb, _super);
    function BlockSkillBomb(owner) {
        return _super.call(this, BattleConst_1.BlockSkill.BOMB, owner) || this;
    }
    BlockSkillBomb.prototype.onDead = function () {
        _super.prototype.onDead.call(this);
        if (this.enable) {
            var startX = slib.MathUtil.clamp(this.owner.gridPos.x - 1, 0, this.owner.map.mapGridSize.x - 1);
            var endX = slib.MathUtil.clamp(this.owner.gridPos.x + 1, 0, this.owner.map.mapGridSize.x - 1);
            var startY = slib.MathUtil.clamp(this.owner.gridPos.y - 1, 0, this.owner.map.mapGridSize.y - 1);
            var endY = slib.MathUtil.clamp(this.owner.gridPos.y + 1, 0, this.owner.map.mapGridSize.y - 1);
            for (var x = startX; x <= endX; ++x) {
                for (var y = startY; y <= endY; ++y) {
                    var block = this.owner.map.getBlockByGridPos(x, y);
                    if (!block || block.uid == this.owner.uid) {
                        continue;
                    }
                    //消除周围的格子
                    if (block) {
                        block.dead();
                    }
                }
            }
            SoundManager_1.SoundManager.ins.playEffect(Global_1.SoundName.BOMB);
        }
    };
    return BlockSkillBomb;
}(BlockSkillBase_1.BlockSkillBase));
exports.BlockSkillBomb = BlockSkillBomb;

cc._RF.pop();