mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Particle Manager no longer uses BuildGameObject and instead manages its own addition to the system lists.
This commit is contained in:
parent
d74018f3d0
commit
6ccae5ec49
1 changed files with 17 additions and 3 deletions
|
@ -1,19 +1,33 @@
|
|||
var BuildGameObject = require('../BuildGameObject');
|
||||
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
|
||||
var GetFastValue = require('../../utils/object/GetFastValue');
|
||||
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
||||
var ParticleEmitterManager = require('./ParticleEmitterManager');
|
||||
|
||||
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
||||
//
|
||||
// There are several properties available to use:
|
||||
//
|
||||
// this.scene - a reference to the Scene that owns the GameObjectFactory
|
||||
// this.displayList - a reference to the Display List the Scene owns
|
||||
// this.updateList - a reference to the Update List the Scene owns
|
||||
|
||||
GameObjectCreator.register('particles', function (config)
|
||||
{
|
||||
var key = GetAdvancedValue(config, 'key', null);
|
||||
var frame = GetAdvancedValue(config, 'frame', null);
|
||||
var emitters = GetAdvancedValue(config, 'emitters', null);
|
||||
var emitters = GetFastValue(config, 'emitters', null);
|
||||
|
||||
// frame is optional and can contain the emitters array or object if skipped
|
||||
var manager = new ParticleEmitterManager(this.scene, key, frame, emitters);
|
||||
|
||||
BuildGameObject(this.scene, manager, config);
|
||||
var add = GetFastValue(config, 'add', false);
|
||||
|
||||
if (add)
|
||||
{
|
||||
this.displayList.add(manager);
|
||||
}
|
||||
|
||||
this.updateList.add(manager);
|
||||
|
||||
return manager;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue