import { SoundManager } from "../../../../component/SoundManager"; import { SoundName } from "../../../../Global"; import { BlockSkill } from "../../BattleConst"; import { BlockData } from "../BlockData"; import { BlockSkillBase } from "./BlockSkillBase"; export class BlockSkillBomb extends BlockSkillBase { constructor(owner: BlockData) { super(BlockSkill.BOMB, owner); } onDead(): void { super.onDead(); if (this.enable) { let startX = slib.MathUtil.clamp(this.owner.gridPos.x - 1, 0, this.owner.map.mapGridSize.x - 1); let endX = slib.MathUtil.clamp(this.owner.gridPos.x + 1, 0, this.owner.map.mapGridSize.x - 1); let startY = slib.MathUtil.clamp(this.owner.gridPos.y - 1, 0, this.owner.map.mapGridSize.y - 1); let endY = slib.MathUtil.clamp(this.owner.gridPos.y + 1, 0, this.owner.map.mapGridSize.y - 1); for (let x = startX; x <= endX; ++x) { for (let y = startY; y <= endY; ++y) { let block = this.owner.map.getBlockByGridPos(x, y); if (!block || block.uid == this.owner.uid) { continue; } //消除周围的格子 if (block) { block.dead(); } } } SoundManager.ins.playEffect(SoundName.BOMB); } } }