phaser/src/animations/manager/AnimationManager.js

165 lines
3.4 KiB
JavaScript
Raw Normal View History

var Class = require('../../utils/Class');
var EventDispatcher = require('../../events/EventDispatcher');
2017-10-04 23:09:12 +00:00
var CustomMap = require('../../structs/Map');
// Animations are managed by the global AnimationManager. This is a singleton class that is
2017-10-04 16:05:26 +00:00
// responsible for creating and delivering animations and their corresponding data to all Game Objects.
// Sprites and other Game Objects get the data they need from the AnimationManager.
// Access it via `scene.anims`.
var AnimationManager = new Class({
initialize:
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @class AnimationManager
* @memberOf Phaser.Animations
* @constructor
* @since 3.0.0
*
* @param {Phaser.Game} game - [description]
*/
function AnimationManager (game)
{
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {Phaser.Game} game
* @protected
*/
this.game = game;
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {[type]} textureManager
* @protected
*/
this.textureManager = null;
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {Phaser.Events.EventDispatcher} events
* @protected
*/
this.events = new EventDispatcher();
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {number} [globalTimeScale=1]
*/
this.globalTimeScale = 1;
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {Phaser.Structs.Map} anims
* @protected
*/
2017-10-04 23:09:12 +00:00
this.anims = new CustomMap();
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @property {boolean} [paused=false]
*/
this.paused = false;
},
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @method Phaser.Animations.AnimationManager#boot
* @since 3.0.0
*
* @param {[type]} textureManager - [description]
*/
boot: function (textureManager)
{
this.textureManager = textureManager;
},
2017-10-04 16:05:26 +00:00
/**
* @requires AddAnimation
*/
add: require('./inc/AddAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires CreateFrameAnimation
*/
create: require('./inc/CreateFrameAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires FromJSON
*/
fromJSON: require('./inc/FromJSON'),
2017-10-04 16:05:26 +00:00
/**
* @requires GenerateFrameNames
*/
generateFrameNames: require('./inc/GenerateFrameNames'),
2017-10-04 16:05:26 +00:00
/**
* @requires GenerateFrameNumbers
*/
generateFrameNumbers: require('./inc/GenerateFrameNumbers'),
2017-10-04 16:05:26 +00:00
/**
* @requires GetAnimation
*/
get: require('./inc/GetAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires LoadAnimationToGameObject
*/
load: require('./inc/LoadAnimationToGameObject'),
2017-10-04 16:05:26 +00:00
/**
* @requires PauseAll
*/
pauseAll: require('./inc/PauseAll'),
2017-10-04 16:05:26 +00:00
/**
* @requires PlayAnimation
*/
play: require('./inc/PlayAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires RemoveAnimation
*/
remove: require('./inc/RemoveAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires ResumeAll
*/
resumeAll: require('./inc/ResumeAll'),
2017-10-04 16:05:26 +00:00
/**
* @requires StaggerPlayAnimation
*/
staggerPlay: require('./inc/StaggerPlayAnimation'),
2017-10-04 16:05:26 +00:00
/**
* @requires ToJSON
*/
toJSON: require('./inc/ToJSON'),
2017-10-04 16:05:26 +00:00
/**
* [description]
*
* @method Phaser.Animations.AnimationManager#destroy
* @since 3.0.0
*/
destroy: function ()
{
// TODO
}
});
module.exports = AnimationManager;