mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 12:43:26 +00:00
Update ParticleEmitter.js
This commit is contained in:
parent
b49cf68e71
commit
f0f82d3a40
1 changed files with 48 additions and 0 deletions
|
@ -368,6 +368,20 @@ var ParticleEmitter = new Class({
|
|||
*/
|
||||
this.particleClass = Particle;
|
||||
|
||||
/**
|
||||
* An internal object holding the configuration for the Emitter.
|
||||
*
|
||||
* These are populated as part of the Emitter configuration parsing.
|
||||
*
|
||||
* You typically do not access them directly, but instead use the
|
||||
* `ParticleEmitter.setConfig` or `ParticleEmitter.updateConfig` methods.
|
||||
*
|
||||
* @name Phaser.GameObjects.Particles.ParticleEmitter#config
|
||||
* @type {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig}
|
||||
* @since 3.90.0
|
||||
*/
|
||||
this.config = null;
|
||||
|
||||
/**
|
||||
* An internal object holding all of the EmitterOp instances.
|
||||
*
|
||||
|
@ -936,6 +950,8 @@ var ParticleEmitter = new Class({
|
|||
return this;
|
||||
}
|
||||
|
||||
this.config = config;
|
||||
|
||||
var i = 0;
|
||||
var key = '';
|
||||
|
||||
|
@ -1052,6 +1068,38 @@ var ParticleEmitter = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Takes an existing Emitter Configuration file and updates this Emitter.
|
||||
* Existing properties are overriden while new properties are added. The
|
||||
* updated configuration is then passed to the `setConfig` method to reset
|
||||
* the Emitter with the updated configuration.
|
||||
*
|
||||
* @method Phaser.GameObjects.Particles.ParticleEmitter#updateConfig
|
||||
* @since 3.60.0
|
||||
*
|
||||
* @param {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig} config - Settings for this emitter.
|
||||
*
|
||||
* @return {this} This Particle Emitter.
|
||||
*/
|
||||
updateConfig: function (config)
|
||||
{
|
||||
if (!config)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
if (!this.config)
|
||||
{
|
||||
this.setConfig(config);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setConfig({...this.config, ...config});
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a description of this emitter suitable for JSON serialization.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue