436fd004-bc32-4758-be17-d5b4b6ca8dbb.js 2.9 KB
"use strict";
cc._RF.push(module, '436fdAEvDJHWL4X1bS2yo27', 'BlockSkillBombView');
// scripts/prefabs/BlockSkillBombView.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.BlockSkillBombView = void 0;
var Global_1 = require("../Global");
var BattleConst_1 = require("../kernel/battle/BattleConst");
var GlobalNode_1 = require("../kernel/GlobalNode");
var BlockSkillViewBase_1 = require("./BlockSkillViewBase");
var BlockSkillBombView = /** @class */ (function (_super) {
    __extends(BlockSkillBombView, _super);
    function BlockSkillBombView(owner, mapView) {
        var _this = _super.call(this, owner, mapView) || this;
        _this._spIdleNode = cc.instantiate(mapView.prefabCollection.getChildByName('skillSpine').getChildByName('game_bomb01'));
        _this._spBoomNode = cc.instantiate(mapView.prefabCollection.getChildByName('skillSpine').getChildByName('game_boom01'));
        _this.onPositionChange(_this._owner.owner.pixelPos.x, _this._owner.owner.pixelPos.y);
        _this._spBoomNode.active = false;
        _this._spIdleNode.active = true;
        mapView.effectLayer.addChild(_this._spBoomNode);
        mapView.effectLayer.addChild(_this._spIdleNode);
        _this._spIdleNode.getComponent(sp.Skeleton).setAnimation(0, 'animation', true);
        return _this;
    }
    BlockSkillBombView.prototype.onPositionChange = function (x, y) {
        this._spBoomNode.setPosition(x, y);
        this._spIdleNode.setPosition(x, y);
    };
    BlockSkillBombView.prototype.onDead = function () {
        var _this = this;
        _super.prototype.onDead.call(this);
        this._spIdleNode.destroy();
        this._spBoomNode.active = true;
        this._spBoomNode.getComponent(sp.Skeleton).setCompleteListener(function () {
            _this._spBoomNode.destroy();
        });
        this._spBoomNode.getComponent(sp.Skeleton).setAnimation(0, 'animation', false);
        //震屏
        BattleConst_1.getGlobalNode().emit(Global_1.GlobalEvent.SHAKE, true);
        BattleConst_1.getGlobalNode().getComponent(GlobalNode_1.default).scheduleOnce(function () { BattleConst_1.getGlobalNode().emit(Global_1.GlobalEvent.SHAKE, false); }, 0.3); //0.5秒后关闭
    };
    return BlockSkillBombView;
}(BlockSkillViewBase_1.BlcokSkillViewBase));
exports.BlockSkillBombView = BlockSkillBombView;

cc._RF.pop();