2017-10-17 03:19:29 +00:00
|
|
|
var BuildGameObject = require('../BuildGameObject');
|
|
|
|
var GameObjectCreator = require('../../scene/plugins/GameObjectCreator');
|
|
|
|
var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
2017-11-08 18:14:14 +00:00
|
|
|
var ParticleEmitterManager = require('./ParticleEmitterManager');
|
2017-10-17 03:19:29 +00:00
|
|
|
|
|
|
|
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
|
|
|
|
|
|
|
GameObjectCreator.register('particles', function (config)
|
|
|
|
{
|
|
|
|
var key = GetAdvancedValue(config, 'key', null);
|
|
|
|
var frame = GetAdvancedValue(config, 'frame', null);
|
2017-11-08 18:14:14 +00:00
|
|
|
var emitters = GetAdvancedValue(config, 'emitters', null);
|
2017-10-17 03:19:29 +00:00
|
|
|
|
2017-11-08 18:14:14 +00:00
|
|
|
var manager = new ParticleEmitterManager(this.scene, key, frame, emitters);
|
2017-10-17 03:19:29 +00:00
|
|
|
|
2017-11-08 18:14:14 +00:00
|
|
|
BuildGameObject(this.scene, manager, config);
|
2017-10-17 03:19:29 +00:00
|
|
|
|
2017-11-08 18:14:14 +00:00
|
|
|
return manager;
|
2017-10-17 03:19:29 +00:00
|
|
|
});
|