粒子效果的暂停和播放
const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Node)
    particle:cc.Node = null

    toggleParticlePlay() 
    {
        let myParticle:cc.ParticleSystem = this.particle.getComponent(cc.ParticleSystem);
        if (myParticle.particleCount > 0) {
            myParticle.stopSystem(); //停止播放粒子
        } else {
            myParticle.resetSystem(); //粒子效果重新播放
        }
    }
}

首页 我的博客
粤ICP备17103704号