085ded7f-72d3-4c85-92a5-f5f26745dd89.js 4.13 KB
"use strict";
cc._RF.push(module, '085de1/ctNMhZKl9fJnRd2J', 'BlcokSkillFireworkView');
// scripts/prefabs/BlcokSkillFireworkView.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.BlockSkillFireworkView = void 0;
var BattleConst_1 = require("../kernel/battle/BattleConst");
var BlockSkillViewBase_1 = require("./BlockSkillViewBase");
var BlockSkillFireworkView = /** @class */ (function (_super) {
    __extends(BlockSkillFireworkView, _super);
    function BlockSkillFireworkView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BlockSkillFireworkView.prototype.onDead = function () {
        _super.prototype.onDead.call(this);
        //播放特效
        if (this._owner.owner.skill.skillId == BattleConst_1.BlockSkill.FIREWORK_VERTICAL || this._owner.owner.skill.skillId == BattleConst_1.BlockSkill.FIREWORK_DOUBLE) {
            var startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos);
            var upEffect_1 = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
            upEffect_1.setPosition(startPixel.x, startPixel.y + 2);
            upEffect_1.active = true;
            var downEffect_1 = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
            downEffect_1.setPosition(startPixel.x, startPixel.y - 2);
            downEffect_1.angle = 180;
            downEffect_1.active = true;
            this._mapView.effectLayer.addChild(upEffect_1);
            this._mapView.effectLayer.addChild(downEffect_1);
            upEffect_1.getComponent(sp.Skeleton).setCompleteListener(function () {
                upEffect_1.destroy();
            });
            upEffect_1.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
            downEffect_1.getComponent(sp.Skeleton).setCompleteListener(function () {
                downEffect_1.destroy();
            });
            downEffect_1.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
        }
        if (this._owner.owner.skill.skillId == BattleConst_1.BlockSkill.FIREWORK_HORIZON || this._owner.owner.skill.skillId == BattleConst_1.BlockSkill.FIREWORK_DOUBLE) {
            var startPixel = this._owner.owner.map.getPixelPosByGridPos(this._owner.owner.gridPos);
            var leftEffect_1 = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
            leftEffect_1.setPosition(startPixel.x + 2, startPixel.y);
            leftEffect_1.angle = 270;
            leftEffect_1.active = true;
            var rightEffect_1 = cc.instantiate(this._mapView.prefabCollection.getChildByName('spineFirework'));
            rightEffect_1.setPosition(startPixel.x - 2, startPixel.y);
            ;
            rightEffect_1.angle = 90;
            rightEffect_1.active = true;
            this._mapView.effectLayer.addChild(leftEffect_1);
            this._mapView.effectLayer.addChild(rightEffect_1);
            leftEffect_1.getComponent(sp.Skeleton).setCompleteListener(function () {
                leftEffect_1.destroy();
            });
            leftEffect_1.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
            rightEffect_1.getComponent(sp.Skeleton).setCompleteListener(function () {
                rightEffect_1.destroy();
            });
            rightEffect_1.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
        }
    };
    return BlockSkillFireworkView;
}(BlockSkillViewBase_1.BlcokSkillViewBase));
exports.BlockSkillFireworkView = BlockSkillFireworkView;

cc._RF.pop();