Skip to content

Commit 6ccae5e

Browse files
committed
Particle Manager no longer uses BuildGameObject and instead manages its own addition to the system lists.
1 parent d74018f commit 6ccae5e

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1-
var BuildGameObject = require('../BuildGameObject');
21
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
2+
var GetFastValue = require('../../utils/object/GetFastValue');
33
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
44
var ParticleEmitterManager = require('./ParticleEmitterManager');
55

66
// When registering a factory function 'this' refers to the GameObjectCreator context.
7+
//
8+
// There are several properties available to use:
9+
//
10+
// this.scene - a reference to the Scene that owns the GameObjectFactory
11+
// this.displayList - a reference to the Display List the Scene owns
12+
// this.updateList - a reference to the Update List the Scene owns
713

814
GameObjectCreator.register('particles', function (config)
915
{
1016
var key = GetAdvancedValue(config, 'key', null);
1117
var frame = GetAdvancedValue(config, 'frame', null);
12-
var emitters = GetAdvancedValue(config, 'emitters', null);
18+
var emitters = GetFastValue(config, 'emitters', null);
1319

20+
// frame is optional and can contain the emitters array or object if skipped
1421
var manager = new ParticleEmitterManager(this.scene, key, frame, emitters);
1522

16-
BuildGameObject(this.scene, manager, config);
23+
var add = GetFastValue(config, 'add', false);
24+
25+
if (add)
26+
{
27+
this.displayList.add(manager);
28+
}
29+
30+
this.updateList.add(manager);
1731

1832
return manager;
1933
});

0 commit comments

Comments
 (0)