2013-08-29 06:06:16 +00:00
|
|
|
/**
|
2013-10-01 12:54:29 +00:00
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2014-02-05 05:54:25 +00:00
|
|
|
* @copyright 2014 Photon Storm Ltd.
|
2013-10-01 12:54:29 +00:00
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-09-13 04:44:04 +00:00
|
|
|
* This is a base State class which can be extended if you are creating your own game.
|
2013-08-29 06:06:16 +00:00
|
|
|
* It provides quick access to common functions such as the camera, cache, input, match, sound and more.
|
|
|
|
*
|
2013-10-01 12:54:29 +00:00
|
|
|
* @class Phaser.State
|
|
|
|
* @constructor
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
Phaser.State = function () {
|
2013-10-02 11:11:22 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Game} game - A reference to the currently running Game.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.game = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-11-25 03:13:04 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.GameObjectFactory} add - Reference to the GameObjectFactory.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.add = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2014-02-25 14:46:48 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.GameObjectCreator} make - Reference to the GameObjectCreator.
|
|
|
|
*/
|
|
|
|
this.make = null;
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Camera} camera - A handy reference to world.camera.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.camera = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Cache} cache - Reference to the assets cache.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.cache = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Input} input - Reference to the input manager
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.input = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Loader} load - Reference to the assets loader.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.load = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Math} math - Reference to the math helper.
|
|
|
|
*/
|
2013-09-13 04:44:04 +00:00
|
|
|
this.math = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.SoundManager} sound - Reference to the sound manager.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.sound = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2014-02-25 14:46:48 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.ScaleManager} scale - Reference to the game scale manager.
|
|
|
|
*/
|
|
|
|
this.scale = null;
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.Stage} stage - Reference to the stage.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.stage = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.TimeManager} time - Reference to game clock.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.time = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.TweenManager} tweens - Reference to the tween manager.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.tweens = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2013-11-25 03:13:04 +00:00
|
|
|
* @property {Phaser.World} world - Reference to the world.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.world = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-11-25 03:13:04 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.Particles} particles - The Particle Manager for the game. It is called during the game update loop and in turn updates any Emitters attached to it.
|
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.particles = null;
|
2014-03-23 07:59:28 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
2014-02-25 14:46:48 +00:00
|
|
|
* @property {Phaser.Physics.World} physics - Reference to the physics manager.
|
2013-11-25 03:13:04 +00:00
|
|
|
*/
|
2013-09-10 19:40:34 +00:00
|
|
|
this.physics = null;
|
|
|
|
|
2014-02-25 14:46:48 +00:00
|
|
|
/**
|
|
|
|
* @property {Phaser.RandomDataGenerator} rnd - Reference to the random data generator.
|
|
|
|
*/
|
|
|
|
this.rnd = null;
|
|
|
|
|
2013-08-29 06:06:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Phaser.State.prototype = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Override this method to add some load operations.
|
|
|
|
* If you need to use the loader, you may need to use them here.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#preload
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
preload: function () {
|
|
|
|
},
|
|
|
|
|
2013-10-02 00:16:40 +00:00
|
|
|
/**
|
|
|
|
* Put update logic here.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#loadUpdate
|
2013-10-02 00:16:40 +00:00
|
|
|
*/
|
|
|
|
loadUpdate: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put render operations here.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#loadRender
|
2013-10-02 00:16:40 +00:00
|
|
|
*/
|
|
|
|
loadRender: function () {
|
|
|
|
},
|
|
|
|
|
2013-08-29 06:06:16 +00:00
|
|
|
/**
|
|
|
|
* This method is called after the game engine successfully switches states.
|
2013-10-01 12:54:29 +00:00
|
|
|
* Feel free to add any setup code here (do not load anything here, override preload() instead).
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#create
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
create: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put update logic here.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#update
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
update: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Put render operations here.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#render
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
render: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method will be called when game paused.
|
2014-03-23 07:59:28 +00:00
|
|
|
*
|
2013-10-02 11:11:22 +00:00
|
|
|
* @method Phaser.State#paused
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
|
|
|
paused: function () {
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2014-03-17 19:43:28 +00:00
|
|
|
* This method will be called when the state is shut down (i.e. you switch to another state from this one).
|
|
|
|
* @method Phaser.State#shutdown
|
2013-08-29 06:06:16 +00:00
|
|
|
*/
|
2014-03-17 19:43:28 +00:00
|
|
|
shutdown: function () {
|
2013-08-29 06:06:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
};
|
2013-12-30 16:54:00 +00:00
|
|
|
|
|
|
|
Phaser.State.prototype.constructor = Phaser.State;
|