@@ -259,85 +259,6 @@ Phaser.StateManager.prototype = {
259259 }
260260 }
261261
262-
263- /* if (this.game.isBooted === false)
264- {
265- this._pendingState = key;
266-
267- if (arguments.length > 3)
268- {
269- this._args = Array.prototype.splice.call(arguments, 3);
270- }
271-
272- return;
273- }
274- else
275- {
276- // If we still have a _pendingState it's left over from game boot, so glob the args
277- if (this._pendingState)
278- {
279- this._pendingState = null;
280- }
281- else
282- {
283- this._args = [];
284- }
285- }
286- if (arguments.length > 3)
287- {
288- this._args = Array.prototype.splice.call(arguments, 3);
289- }
290-
291- if (this.checkState(key) === false)
292- {
293- return;
294- }
295- else
296- {
297- // Already got a state running?
298- if (this.current)
299- {
300- this.onShutDownCallback.call(this.callbackContext, this.game);
301- }
302-
303- if (clearWorld)
304- {
305- this.game.tweens.removeAll();
306-
307- this.game.world.destroy();
308-
309- if (clearCache === true)
310- {
311- this.game.cache.destroy();
312- }
313- }
314-
315- this.setCurrentState(key);
316- }
317-
318- if (this.onPreloadCallback)
319- {
320- this.game.load.reset();
321- this.onPreloadCallback.call(this.callbackContext, this.game);
322-
323- // Is the loader empty?
324- if (this.game.load.totalQueuedFiles() === 0)
325- {
326- this.game.loadComplete();
327- }
328- else
329- {
330- // Start the loader going as we have something in the queue
331- this.game.load.start();
332- }
333- }
334- else
335- {
336- // No init? Then there was nothing to load either
337- this.game.loadComplete();
338- }
339- */
340-
341262 } ,
342263
343264 /**
@@ -349,11 +270,9 @@ Phaser.StateManager.prototype = {
349270 } ,
350271
351272 /**
352- * Checks if a given phaser state is valid.
353- * State must exist and have at least one callback function registered..
354- * @method Phaser.StateManager#checkState
355- * @param {string } key - The key of the state you want to check.
356- * @return {boolean } Description.
273+ * preUpdate is called right at the start of the game loop. It is responsible for changing to a new state that was requested previously.
274+ *
275+ * @method Phaser.StateManager#preUpdate
357276 */
358277 preUpdate : function ( ) {
359278
@@ -502,6 +421,8 @@ Phaser.StateManager.prototype = {
502421
503422 this . onInitCallback . apply ( this . callbackContext , this . _args ) ;
504423
424+ this . _args = [ ] ;
425+
505426 } ,
506427
507428 /**
0 commit comments