Skip to content

Commit 0b9dd4a

Browse files
committed
GameObjectCreator.events is a new property that references the Scene's Event Emitter. This is now used internally.
1 parent 671c92e commit 0b9dd4a

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/gameobjects/GameObjectCreator.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ var GameObjectCreator = new Class({
5050
*/
5151
this.systems = scene.sys;
5252

53+
/**
54+
* A reference to the Scene Event Emitter.
55+
*
56+
* @name Phaser.GameObjects.GameObjectCreator#events
57+
* @type {Phaser.Events.EventEmitter}
58+
* @protected
59+
* @since 3.50.0
60+
*/
61+
this.events = scene.sys.events;
62+
5363
/**
5464
* A reference to the Scene Display List.
5565
*
@@ -70,8 +80,8 @@ var GameObjectCreator = new Class({
7080
*/
7181
this.updateList;
7282

73-
scene.sys.events.once(SceneEvents.BOOT, this.boot, this);
74-
scene.sys.events.on(SceneEvents.START, this.start, this);
83+
this.events.once(SceneEvents.BOOT, this.boot, this);
84+
this.events.on(SceneEvents.START, this.start, this);
7585
},
7686

7787
/**
@@ -87,7 +97,7 @@ var GameObjectCreator = new Class({
8797
this.displayList = this.systems.displayList;
8898
this.updateList = this.systems.updateList;
8999

90-
this.systems.events.once(SceneEvents.DESTROY, this.destroy, this);
100+
this.events.once(SceneEvents.DESTROY, this.destroy, this);
91101
},
92102

93103
/**
@@ -101,7 +111,7 @@ var GameObjectCreator = new Class({
101111
*/
102112
start: function ()
103113
{
104-
this.systems.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
114+
this.events.once(SceneEvents.SHUTDOWN, this.shutdown, this);
105115
},
106116

107117
/**
@@ -114,7 +124,7 @@ var GameObjectCreator = new Class({
114124
*/
115125
shutdown: function ()
116126
{
117-
this.systems.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
127+
this.events.off(SceneEvents.SHUTDOWN, this.shutdown, this);
118128
},
119129

120130
/**
@@ -129,10 +139,12 @@ var GameObjectCreator = new Class({
129139
{
130140
this.shutdown();
131141

132-
this.scene.sys.events.off(SceneEvents.START, this.start, this);
142+
this.events.off(SceneEvents.START, this.start, this);
133143

134144
this.scene = null;
135145
this.systems = null;
146+
this.events = null;
147+
136148
this.displayList = null;
137149
this.updateList = null;
138150
}

0 commit comments

Comments
 (0)