phaser/src/gameobjects/GameObjectCreator.js

61 lines
1.3 KiB
JavaScript
Raw Normal View History

var Class = require('../../utils/Class');
2018-01-16 02:08:22 +00:00
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;
this.mapping = 'make';
this.systems.events.on('boot', this.boot, this);
this.displayList;
this.updateList;
},
2018-01-16 02:08:22 +00:00
boot: function ()
{
this.systems.inject(this);
this.displayList = this.systems.displayList;
this.updateList = this.systems.updateList;
this.systems.events.on('shutdown', this.shutdown, this);
this.systems.events.on('destroy', this.destroy, this);
},
shutdown: function ()
{
2018-01-16 02:08:22 +00:00
},
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;
}
};
2018-01-16 02:08:22 +00:00
PluginManager.register('make', GameObjectCreator);
module.exports = GameObjectCreator;