dad85471-e946-4075-b303-a591d4d6dbd9.js 3.71 KB
"use strict";
cc._RF.push(module, 'dad85Rx6UZAdbMDpZHU1tvZ', 'BigBombView');
// scripts/prefabs/BigBombView.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 __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var SoundManager_1 = require("../component/SoundManager");
var Global_1 = require("../Global");
var BattleConst_1 = require("../kernel/battle/BattleConst");
var RectBlockView_1 = require("./RectBlockView");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var BigBombView = /** @class */ (function (_super) {
    __extends(BigBombView, _super);
    function BigBombView() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BigBombView.prototype.init = function (owner, mapView) {
        _super.prototype.init.call(this, owner, mapView);
        this._imgEffect.active = true;
        this._spine = this._imgEffect.getChildByName('sp').getComponent(sp.Skeleton);
        if (owner.type == BattleConst_1.ObjType.BIG_BOMB_33) {
            this._imgEffect.scale = 1.5;
        }
    };
    BigBombView.prototype.onBeginContact = function (contact, selfCollider, otherCollider) {
        var _this = this;
        if (this._spine.animation == 'boom') {
            return; //已触发了爆炸,屏蔽碰撞
        }
        if (otherCollider.node.name == "ball") {
            this._spine.setCompleteListener(function () {
                _this._spine.setAnimation(0, 'stay', true);
            });
            if (this._spine.animation != 'hit') {
                this._spine.setAnimation(0, 'hit', false);
            }
        }
        _super.prototype.onBeginContact.call(this, contact, selfCollider, otherCollider);
    };
    BigBombView.prototype.bomb = function () {
        var _this = this;
        this.setColliderEnable(false);
        this._spine.setAnimation(0, 'boom', false);
        this._spine.setCompleteListener(function () {
            _this._owner.onBombFinish();
        });
        this.scheduleOnce(function () {
            SoundManager_1.SoundManager.ins.playEffect(Global_1.SoundName.BOMB);
            BattleConst_1.getGlobalNode().emit(Global_1.GlobalEvent.SHAKE, false);
        }, 1.5);
        BattleConst_1.getGlobalNode().emit(Global_1.GlobalEvent.SHAKE, true);
    };
    BigBombView.prototype.onVisibleChange = function () {
        _super.prototype.onVisibleChange.call(this);
        this._img.active = false;
        this._imgEffect.active = this._visible;
    };
    BigBombView = __decorate([
        ccclass
    ], BigBombView);
    return BigBombView;
}(RectBlockView_1.default));
exports.default = BigBombView;

cc._RF.pop();