GameObjectFactory.events is a new property that references the Scene's Event Emitter. This is now used internally.

This commit is contained in:
Richard Davey 2020-08-24 19:20:20 +01:00
parent 0b9dd4aae7
commit 19c4980c5b

View file

@ -49,6 +49,16 @@ var GameObjectFactory = new Class({
*/
this.systems = scene.sys;
/**
* A reference to the Scene Event Emitter.
*
* @name Phaser.GameObjects.GameObjectFactory#events
* @type {Phaser.Events.EventEmitter}
* @protected
* @since 3.50.0
*/
this.events = scene.sys.events;
/**
* A reference to the Scene Display List.
*
@ -69,8 +79,8 @@ var GameObjectFactory = new Class({
*/
this.updateList;
scene.sys.events.once(SceneEvents.BOOT, this.boot, this);
scene.sys.events.on(SceneEvents.START, this.start, this);
this.events.once(SceneEvents.BOOT, this.boot, this);
this.events.on(SceneEvents.START, this.start, this);
},
/**
@ -86,7 +96,7 @@ var GameObjectFactory = new Class({
this.displayList = this.systems.displayList;
this.updateList = this.systems.updateList;
this.systems.events.once(SceneEvents.DESTROY, this.destroy, this);
this.events.once(SceneEvents.DESTROY, this.destroy, this);
},
/**
@ -100,7 +110,7 @@ var GameObjectFactory = new Class({
*/
start: function ()
{
this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@ -143,7 +153,7 @@ var GameObjectFactory = new Class({
*/
shutdown: function ()
{
this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
},
/**
@ -158,10 +168,11 @@ var GameObjectFactory = new Class({
{
this.shutdown();
this.scene.sys.events.off(SceneEvents.START, this.start, this);
this.events.off(SceneEvents.START, this.start, this);
this.scene = null;
this.systems = null;
this.events = null;
this.displayList = null;
this.updateList = null;