"use strict"; cc._RF.push(module, '8cda55HFDtFTJExsjkUU0IA', 'Blast'); // Texture/prefab/Blast.js "use strict"; /** * 消除特效 */ var Blast = cc.Class({ "extends": cc.Component, editor: { menu: '爆炸效果预制' }, properties: { label: cc.Label, blast: cc.Animation, spriteFrames: [cc.SpriteFrame] }, statics: { pool: cc.NodePool }, run: function run(score, index) { var _this = this; //分数label this.label.string = score; this.label.node.position = cc.v2(0, 0); this.label.node.opacity = 255; var moveBy = cc.moveBy(0.8, cc.v2(0, 180)); var fadeOut = cc.fadeOut(0.8); this.label.node.runAction(cc.sequence(moveBy, fadeOut)); //爆炸动画 this.blast.play(); this.blast.once(cc.Animation.EventType.FINISHED, function () { Blast.pool.put(_this.node); }, this); for (var i = 0; i <= 4; ++i) { var count = i == 0 ? '' : i; var tmp = cc.find('particlesystem' + count, this.blast.node); if (tmp) { var prticle = tmp.getComponent(cc.ParticleSystem); prticle.spriteFrame = this.spriteFrames[index]; prticle.resetSystem(); } } } }); cc.game.on(cc.game.EVENT_GAME_INITED, function () { Blast.pool = new cc.NodePool(); }); cc._RF.pop();