phaser/src/gameobjects/GameObjectCreator.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-01-16 19:49:13 +00:00
var Class = require('../utils/Class');
var PluginManager = require('../plugins/PluginManager');
var GameObjectCreator = new Class({
initialize:
function GameObjectCreator (scene)
{
2018-01-16 02:08:22 +00:00
// The Scene that owns this plugin
this.scene = scene;
2018-01-16 02:08:22 +00:00
this.systems = scene.sys;
if (!scene.sys.settings.isBooted)
{
scene.sys.events.once('boot', this.boot, this);
}
2018-01-16 02:08:22 +00:00
this.displayList;
this.updateList;
},
2018-01-16 02:08:22 +00:00
boot: function ()
{
this.displayList = this.systems.displayList;
this.updateList = this.systems.updateList;
var eventEmitter = this.systems.events;
eventEmitter.on('shutdown', this.shutdown, this);
eventEmitter.on('destroy', this.destroy, this);
2018-01-16 02:08:22 +00:00
},
shutdown: function ()
{
// TODO
},
destroy: function ()
{
this.scene = null;
this.displayList = null;
this.updateList = null;
}
});
// Static method called directly by the Game Object creator functions
GameObjectCreator.register = function (type, factoryFunction)
{
if (!GameObjectCreator.prototype.hasOwnProperty(type))
{
GameObjectCreator.prototype[type] = factoryFunction;
}
};
PluginManager.register('GameObjectCreator', GameObjectCreator, 'make');
2018-01-16 02:08:22 +00:00
module.exports = GameObjectCreator;