import { BlockSkill } from "../kernel/battle/BattleConst"; import { BlcokSkillViewBase } from "./BlockSkillViewBase"; export class BlockSkillFireworkView extends BlcokSkillViewBase { onDead(): void { super.onDead(); //播放特效 if (this._owner.owner.skill.skillId == BlockSkill.FIREWORK_VERTICAL || this._owner.owner.skill.skillId == BlockSkill.FIREWORK_DOUBLE) { let startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos); let upEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework')); upEffect.setPosition(startPixel.x, startPixel.y + 2); upEffect.active = true; let downEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework')); downEffect.setPosition(startPixel.x, startPixel.y - 2); downEffect.angle = 180; downEffect.active = true; this._mapView.effectLayer.addChild(upEffect); this._mapView.effectLayer.addChild(downEffect); upEffect.getComponent(sp.Skeleton).setCompleteListener(() => { upEffect.destroy(); }); upEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false); downEffect.getComponent(sp.Skeleton).setCompleteListener(() => { downEffect.destroy(); }); downEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false); } if (this._owner.owner.skill.skillId == BlockSkill.FIREWORK_HORIZON || this._owner.owner.skill.skillId == BlockSkill.FIREWORK_DOUBLE) { let startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos); let leftEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework')); leftEffect.setPosition(startPixel.x + 2, startPixel.y); leftEffect.angle = 270; leftEffect.active = true; let rightEffect = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework')); rightEffect.setPosition(startPixel.x - 2, startPixel.y);; rightEffect.angle = 90; rightEffect.active = true; this._mapView.effectLayer.addChild(leftEffect); this._mapView.effectLayer.addChild(rightEffect); leftEffect.getComponent(sp.Skeleton).setCompleteListener(() => { leftEffect.destroy(); }); leftEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false); rightEffect.getComponent(sp.Skeleton).setCompleteListener(() => { rightEffect.destroy(); }); rightEffect.getComponent(sp.Skeleton).setAnimation(0, 'animation', false); } } }