2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2013 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
* @module Phaser.Particles
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Phaser.Particles constructor
|
|
|
|
* @class Phaser.Particles
|
|
|
|
* @classdesc Phaser Particles
|
|
|
|
* @constructor
|
|
|
|
* @param {Phaser.Game} game - A reference to the currently running game.
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
Phaser.Particles = function (game) {
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Description} emitters - Description.
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
this.emitters = {};
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {number} ID - Description.
|
|
|
|
* @default
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
this.ID = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Phaser.Particles.prototype = {
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* Description.
|
|
|
|
* @method emitters
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
emitters: null,
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* Description.
|
|
|
|
* @method add
|
|
|
|
* @param {Description} emitter - Description.
|
|
|
|
* @return {Description} Description.
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
add: function (emitter) {
|
|
|
|
|
|
|
|
this.emitters[emitter.name] = emitter;
|
|
|
|
|
|
|
|
return emitter;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* Description.
|
|
|
|
* @method remove
|
|
|
|
* @param {Description} emitter - Description.
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
remove: function (emitter) {
|
|
|
|
|
|
|
|
delete this.emitters[emitter.name];
|
|
|
|
|
|
|
|
},
|
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* Description.
|
|
|
|
* @method update
|
|
|
|
* @param {Description} emitter - Description.
|
|
|
|
*/
|
2013-09-10 10:09:25 +00:00
|
|
|
update: function () {
|
|
|
|
|
|
|
|
for (var key in this.emitters)
|
|
|
|
{
|
|
|
|
if (this.emitters[key].exists)
|
|
|
|
{
|
|
|
|
this.emitters[key].update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|