var Class = require('../utils/Class'); var PluginCache = require('../plugins/PluginCache'); var SceneEvents = require('../scene/events'); var GameObjectCreator = new Class({ initialize: function GameObjectCreator(scene){ this.scene = scene; this.systems = scene.sys; this.displayList; this.updateList; scene.sys.events.once(SceneEvents.BOOT, this.boot, this); scene.sys.events.on(SceneEvents.START, this.start, this); } , boot: function (){ this.displayList = this.systems.displayList; this.updateList = this.systems.updateList; this.systems.events.once(SceneEvents.DESTROY, this.destroy, this); } , start: function (){ this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this); } , shutdown: function (){ this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this); } , destroy: function (){ this.shutdown(); this.scene.sys.events.off(SceneEvents.START, this.start, this); this.scene = null ; this.systems = null ; this.displayList = null ; this.updateList = null ; } } ); GameObjectCreator.register = function (factoryType, factoryFunction){ if (!GameObjectCreator.prototype.hasOwnProperty(factoryType)) { GameObjectCreator.prototype[factoryType] = factoryFunction; } } ; PluginCache.register('GameObjectCreator', GameObjectCreator, 'make'); module.exports = GameObjectCreator;