No longer injects update into a Scene, and now calls step from init onwards.

This commit is contained in:
Richard Davey 2018-06-12 16:21:17 +01:00
parent f0348834c6
commit eb8d3ccdf1

View file

@ -540,7 +540,7 @@ var SceneManager = new Class({
{
var sys = this.scenes[i].sys;
if (sys.settings.status === CONST.RUNNING)
if (sys.settings.status > CONST.START && sys.settings.status <= CONST.RUNNING)
{
sys.step(time, delta);
}
@ -617,6 +617,12 @@ var SceneManager = new Class({
}
}
// If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP
if (scene.update)
{
sys.sceneUpdate = scene.update;
}
settings.status = CONST.RUNNING;
},
@ -660,11 +666,6 @@ var SceneManager = new Class({
newScene.sys.init(this.game);
if (!newScene.update)
{
newScene.update = NOOP;
}
return newScene;
}
},
@ -736,12 +737,6 @@ var SceneManager = new Class({
{
var sceneCallback = GetValue(sceneConfig, defaults[i], null);
// Must always have an update function, no matter what (the rest are optional)
if (defaults[i] === 'update' && !sceneCallback)
{
sceneCallback = NOOP;
}
if (sceneCallback)
{
newScene[defaults[i]] = sceneCallback;