Add ParticleEmitter.remove() and ParticleEmitterManager#removeEmitter()

This commit is contained in:
samme 2019-12-23 10:36:35 -08:00
parent 64690cf987
commit 15506e0faf
2 changed files with 30 additions and 0 deletions

View file

@ -1782,6 +1782,21 @@ var ParticleEmitter = new Class({
return this; return this;
}, },
/**
* Removes the emitter from its manager and the scene.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#remove
* @since 3.22.0
*
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
*/
remove: function ()
{
this.manager.removeEmitter(this);
return this;
},
/** /**
* Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}. * Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}.
* *

View file

@ -277,6 +277,21 @@ var ParticleEmitterManager = new Class({
return this.addEmitter(new ParticleEmitter(this, config)); return this.addEmitter(new ParticleEmitter(this, config));
}, },
/**
* Removes a Particle Emitter from this Emitter Manager, if the Emitter belongs to this Manager.
*
* @method Phaser.GameObjects.Particles.ParticleEmitterManager#removeEmitter
* @since 3.22.0
*
* @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter
*
* @return {?Phaser.GameObjects.Particles.ParticleEmitter} The Particle Emitter if it was removed or null if it was not.
*/
removeEmitter: function (emitter)
{
return this.emitters.remove(emitter, true);
},
/** /**
* Adds an existing Gravity Well object to this Emitter Manager. * Adds an existing Gravity Well object to this Emitter Manager.
* *