2017-10-20 02:20:39 +00:00
|
|
|
var BlendModes = require('../../renderer/BlendModes');
|
2017-10-17 03:16:52 +00:00
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
var Components = require('../components');
|
2017-10-29 21:46:41 +00:00
|
|
|
var DeathZone = require('./zones/DeathZone');
|
2017-10-26 16:02:34 +00:00
|
|
|
var EdgeZone = require('./zones/EdgeZone');
|
2017-10-25 01:25:06 +00:00
|
|
|
var EmitterOp = require('./EmitterOp');
|
|
|
|
var GetFastValue = require('../../utils/object/GetFastValue');
|
2017-10-20 02:20:39 +00:00
|
|
|
var GetRandomElement = require('../../utils/array/GetRandomElement');
|
|
|
|
var GetValue = require('../../utils/object/GetValue');
|
2017-10-30 02:23:08 +00:00
|
|
|
var HasAny = require('../../utils/object/HasAny');
|
2018-02-06 22:25:23 +00:00
|
|
|
var HasValue = require('../../utils/object/HasValue');
|
2017-10-17 03:16:52 +00:00
|
|
|
var Particle = require('./Particle');
|
2017-10-26 16:02:34 +00:00
|
|
|
var RandomZone = require('./zones/RandomZone');
|
2017-10-25 01:25:06 +00:00
|
|
|
var Rectangle = require('../../geom/rectangle/Rectangle');
|
2017-10-17 03:16:52 +00:00
|
|
|
var StableSort = require('../../utils/array/StableSort');
|
2017-10-20 13:13:48 +00:00
|
|
|
var Vector2 = require('../../math/Vector2');
|
2017-10-27 13:51:52 +00:00
|
|
|
var Wrap = require('../../math/Wrap');
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @class ParticleEmitter
|
|
|
|
* @memberOf Phaser.GameObjects.Particles
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @extends Phaser.GameObjects.Components.BlendMode
|
|
|
|
* @extends Phaser.GameObjects.Components.ScrollFactor
|
|
|
|
* @extends Phaser.GameObjects.Components.Visible
|
|
|
|
*
|
|
|
|
* @param {Phaser.GameObjects.Particles.ParticleEmitterManager} manager - The Emitter Manager this Emitter belongs to.
|
|
|
|
* @param {object} config - [description]
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
var ParticleEmitter = new Class({
|
|
|
|
|
|
|
|
Mixins: [
|
|
|
|
Components.BlendMode,
|
|
|
|
Components.ScrollFactor,
|
|
|
|
Components.Visible
|
|
|
|
],
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
|
|
|
function ParticleEmitter (manager, config)
|
|
|
|
{
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* The Emitter Manager this Emitter belongs to.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#manager
|
|
|
|
* @type {Phaser.GameObjects.Particles.ParticleEmitterManager}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
this.manager = manager;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#texture
|
|
|
|
* @type {Phaser.Textures.Texture}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-19 23:54:47 +00:00
|
|
|
this.texture = manager.texture;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#frames
|
|
|
|
* @type {Phaser.Textures.Frame[]}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-19 23:54:47 +00:00
|
|
|
this.frames = [ manager.defaultFrame ];
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#defaultFrame
|
|
|
|
* @type {Phaser.Textures.Frame}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-20 02:20:39 +00:00
|
|
|
this.defaultFrame = manager.defaultFrame;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#configFastMap
|
|
|
|
* @type {object}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.configFastMap = [
|
|
|
|
'active',
|
|
|
|
'blendMode',
|
|
|
|
'collideBottom',
|
|
|
|
'collideLeft',
|
|
|
|
'collideRight',
|
|
|
|
'collideTop',
|
|
|
|
'deathCallback',
|
|
|
|
'deathCallbackScope',
|
|
|
|
'emitCallback',
|
|
|
|
'emitCallbackScope',
|
|
|
|
'follow',
|
|
|
|
'frequency',
|
|
|
|
'gravityX',
|
|
|
|
'gravityY',
|
|
|
|
'maxParticles',
|
|
|
|
'name',
|
|
|
|
'on',
|
|
|
|
'particleBringToTop',
|
|
|
|
'particleClass',
|
|
|
|
'radial',
|
|
|
|
'timeScale',
|
|
|
|
'trackVisible',
|
|
|
|
'visible'
|
|
|
|
];
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#configOpMap
|
|
|
|
* @type {object}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.configOpMap = [
|
|
|
|
'accelerationX',
|
|
|
|
'accelerationY',
|
|
|
|
'alpha',
|
|
|
|
'bounce',
|
|
|
|
'delay',
|
|
|
|
'lifespan',
|
|
|
|
'maxVelocityX',
|
|
|
|
'maxVelocityY',
|
|
|
|
'moveToX',
|
|
|
|
'moveToY',
|
|
|
|
'quantity',
|
|
|
|
'rotate',
|
|
|
|
'scaleX',
|
|
|
|
'scaleY',
|
|
|
|
'speedX',
|
|
|
|
'speedY',
|
|
|
|
'tint',
|
|
|
|
'x',
|
|
|
|
'y'
|
|
|
|
];
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* The name of this Game Object.
|
|
|
|
*
|
|
|
|
* Empty by default and never populated by Phaser, this is left for developers to use.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#name
|
|
|
|
* @type {string}
|
|
|
|
* @default ''
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.name = '';
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* The Particle Class which will be emitted by this Emitter.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleClass
|
|
|
|
* @type {Phaser.GameObjects.Particles.Particle}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.particleClass = Particle;
|
2017-10-27 13:51:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#x
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.x = new EmitterOp(config, 'x', 0);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#y
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.y = new EmitterOp(config, 'y', 0);
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* A radial emitter will emit particles in all directions between angle min and max,
|
|
|
|
* using speed as the value. If set to false then this acts as a point Emitter.
|
|
|
|
* A point emitter will emit particles only in the direction derived from the speedX and speedY values.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#radial
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.radial = true;
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#gravityX
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.gravityX = 0;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#gravityY
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.gravityY = 0;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration
|
|
|
|
* @type {boolean}
|
|
|
|
* @default false
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.acceleration = false;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationX
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.accelerationX = new EmitterOp(config, 'accelerationX', 0, true);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationY
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.accelerationY = new EmitterOp(config, 'accelerationY', 0, true);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX
|
|
|
|
* @type {number}
|
|
|
|
* @default 10000
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.maxVelocityX = new EmitterOp(config, 'maxVelocityX', 10000, true);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY
|
|
|
|
* @type {number}
|
|
|
|
* @default 10000
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.maxVelocityY = new EmitterOp(config, 'maxVelocityY', 10000, true);
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#speedX
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.speedX = new EmitterOp(config, 'speedX', 0, true);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#speedY
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.speedY = new EmitterOp(config, 'speedY', 0, true);
|
2017-10-24 02:02:03 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#moveTo
|
|
|
|
* @type {boolean}
|
|
|
|
* @default false
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-27 20:19:21 +00:00
|
|
|
this.moveTo = false;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#moveToX
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-27 20:19:21 +00:00
|
|
|
this.moveToX = new EmitterOp(config, 'moveToX', 0, true);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#moveToY
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-27 20:19:21 +00:00
|
|
|
this.moveToY = new EmitterOp(config, 'moveToY', 0, true);
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#bounce
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 15:04:05 +00:00
|
|
|
this.bounce = new EmitterOp(config, 'bounce', 0, true);
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#scaleX
|
|
|
|
* @type {float}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.scaleX = new EmitterOp(config, 'scaleX', 1);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#scaleY
|
|
|
|
* @type {float}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.scaleY = new EmitterOp(config, 'scaleY', 1);
|
2017-10-21 04:05:51 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#tint
|
|
|
|
* @type {integer}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-27 20:19:21 +00:00
|
|
|
this.tint = new EmitterOp(config, 'tint', 0xffffffff);
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#alpha
|
|
|
|
* @type {float}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.alpha = new EmitterOp(config, 'alpha', 1);
|
2017-10-20 17:49:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#lifespan
|
|
|
|
* @type {number}
|
|
|
|
* @default 1000
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
this.lifespan = new EmitterOp(config, 'lifespan', 1000);
|
2017-10-20 17:49:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#angle
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:31:54 +00:00
|
|
|
this.angle = new EmitterOp(config, 'angle', { min: 0, max: 360 });
|
2017-10-20 17:49:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#rotate
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-24 02:31:54 +00:00
|
|
|
this.rotate = new EmitterOp(config, 'rotate', 0);
|
2017-10-20 17:49:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback
|
|
|
|
* @type {?function}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.emitCallback = null;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope
|
|
|
|
* @type {?object}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.emitCallbackScope = null;
|
2017-10-21 04:05:51 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback
|
|
|
|
* @type {?function}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.deathCallback = null;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope
|
|
|
|
* @type {?object}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.deathCallbackScope = null;
|
2017-10-21 04:05:51 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* Set to hard limit the amount of particle objects this emitter is allowed to create.
|
|
|
|
* 0 means unlimited.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.maxParticles = 0;
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* How many particles are emitted each time the emitter updates.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#quantity
|
|
|
|
* @type {number}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.quantity = new EmitterOp(config, 'quantity', 1, true);
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* How many ms to wait after emission before the particles start updating.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#delay
|
|
|
|
* @type {number}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-27 11:31:37 +00:00
|
|
|
this.delay = new EmitterOp(config, 'delay', 0, true);
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* How often a particle is emitted in ms (if emitter is a constant / flow emitter)
|
|
|
|
* If emitter is an explosion emitter this value will be -1.
|
|
|
|
* Anything > -1 sets this to be a flow emitter.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#frequency
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.frequency = 0;
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* Controls if the emitter is currently emitting particles.
|
|
|
|
* Already alive particles will continue to update until they expire.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#on
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.on = true;
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive.
|
|
|
|
* Set to false to send them to the back.
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.particleBringToTop = true;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#timeScale
|
|
|
|
* @type {number}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.timeScale = 1;
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#emitZone
|
|
|
|
* @type {?object}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.emitZone = null;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#deathZone
|
|
|
|
* @type {?object}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.deathZone = null;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#bounds
|
|
|
|
* @type {?Phaser.Geom.Rectangle}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.bounds = null;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#collideLeft
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.collideLeft = true;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#collideRight
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.collideRight = true;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#collideTop
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.collideTop = true;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#collideBottom
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.collideBottom = true;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#active
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.active = true;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#visible
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.visible = true;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode
|
|
|
|
* @type {integer}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.blendMode = BlendModes.NORMAL;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#follow
|
|
|
|
* @type {?[type]}
|
|
|
|
* @default null
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.follow = null;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#followOffset
|
|
|
|
* @type {Phaser.Math.Vector2}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.followOffset = new Vector2();
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#trackVisible
|
|
|
|
* @type {boolean}
|
|
|
|
* @default false
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.trackVisible = false;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.currentFrame = 0;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#randomFrame
|
|
|
|
* @type {boolean}
|
|
|
|
* @default true
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.randomFrame = true;
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity
|
|
|
|
* @type {number}
|
|
|
|
* @default 1
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this.frameQuantity = 1;
|
2017-10-20 02:20:39 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#dead
|
|
|
|
* @type {array}
|
|
|
|
* @private
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-20 02:20:39 +00:00
|
|
|
this.dead = [];
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#alive
|
|
|
|
* @type {array}
|
|
|
|
* @private
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-20 02:20:39 +00:00
|
|
|
this.alive = [];
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#_counter
|
|
|
|
* @type {number}
|
|
|
|
* @private
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
this._counter = 0;
|
2018-02-06 22:25:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter
|
|
|
|
* @type {number}
|
|
|
|
* @private
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
this._frameCounter = 0;
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (config)
|
|
|
|
{
|
|
|
|
this.fromJSON(config);
|
|
|
|
}
|
|
|
|
},
|
2017-10-26 16:02:34 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#fromJSON
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} config - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
fromJSON: function (config)
|
|
|
|
{
|
|
|
|
if (!config)
|
2017-10-26 16:02:34 +00:00
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
return this;
|
2017-10-29 21:46:41 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
// Only update properties from their current state if they exist in the given config
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
var key = '';
|
2017-10-29 21:46:41 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
for (i = 0; i < this.configFastMap.length; i++)
|
2017-10-29 21:46:41 +00:00
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
key = this.configFastMap[i];
|
|
|
|
|
|
|
|
if (HasValue(config, key))
|
|
|
|
{
|
|
|
|
this[key] = GetFastValue(config, key);
|
|
|
|
}
|
2017-10-26 16:02:34 +00:00
|
|
|
}
|
2017-10-24 15:04:05 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
for (i = 0; i < this.configOpMap.length; i++)
|
|
|
|
{
|
|
|
|
key = this.configOpMap[i];
|
2017-10-25 01:25:06 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, key))
|
|
|
|
{
|
|
|
|
this[key].loadConfig(config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.acceleration = (this.accelerationX.propertyValue !== 0 || this.accelerationY.propertyValue !== 0);
|
|
|
|
|
|
|
|
this.moveTo = (this.moveToX.propertyValue !== 0 || this.moveToY.propertyValue !== 0);
|
|
|
|
|
|
|
|
// Special 'speed' override
|
|
|
|
|
|
|
|
if (HasValue(config, 'speed'))
|
2017-10-25 01:25:06 +00:00
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
this.speedX.loadConfig(config, 'speed');
|
|
|
|
this.speedY = null;
|
2017-10-25 01:25:06 +00:00
|
|
|
}
|
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
// If you specify speedX, speedY ot moveTo then it changes the emitter from radial to a point emitter
|
|
|
|
if (HasAny(config, [ 'speedX', 'speedY' ]) || this.moveTo)
|
|
|
|
{
|
|
|
|
this.radial = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Special 'scale' override
|
2017-10-24 15:04:05 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, 'scale'))
|
|
|
|
{
|
|
|
|
this.scaleX.loadConfig(config, 'scale');
|
|
|
|
this.scaleY = null;
|
|
|
|
}
|
2017-10-20 02:20:39 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, 'callbackScope'))
|
|
|
|
{
|
|
|
|
var callbackScope = GetFastValue(config, 'callbackScope', null);
|
2017-10-20 02:20:39 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
this.emitCallbackScope = callbackScope;
|
|
|
|
this.deathCallbackScope = callbackScope;
|
|
|
|
}
|
2017-10-20 02:48:42 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, 'emitZone'))
|
|
|
|
{
|
|
|
|
this.setEmitZone(config.emitZone);
|
|
|
|
}
|
2017-10-20 02:20:39 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, 'deathZone'))
|
2017-10-20 02:20:39 +00:00
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
this.setDeathZone(config.deathZone);
|
2017-10-20 02:20:39 +00:00
|
|
|
}
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (HasValue(config, 'bounds'))
|
|
|
|
{
|
|
|
|
this.setBounds(config.bounds);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (HasValue(config, 'followOffset'))
|
|
|
|
{
|
|
|
|
this.followOffset.setFromObject(GetFastValue(config, 'followOffset', 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (HasValue(config, 'frame'))
|
|
|
|
{
|
|
|
|
this.setFrame(config.frame);
|
|
|
|
}
|
2017-10-23 16:11:13 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
return this;
|
2017-10-23 16:11:13 +00:00
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#toJSON
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} output - [description]
|
|
|
|
*
|
|
|
|
* @return {object} [description]
|
|
|
|
*/
|
2017-10-30 02:23:08 +00:00
|
|
|
toJSON: function (output)
|
2017-10-23 16:11:13 +00:00
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
if (output === undefined) { output = {}; }
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
var key = '';
|
|
|
|
|
|
|
|
for (i = 0; i < this.configFastMap.length; i++)
|
|
|
|
{
|
|
|
|
key = this.configFastMap[i];
|
|
|
|
|
|
|
|
output[key] = this[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < this.configOpMap.length; i++)
|
|
|
|
{
|
|
|
|
key = this.configOpMap[i];
|
2017-10-23 16:11:13 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
if (this[key])
|
|
|
|
{
|
|
|
|
output[key] = this[key].toJSON();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// special handlers
|
|
|
|
if (!this.speedY)
|
|
|
|
{
|
|
|
|
delete output.speedX;
|
|
|
|
output.speed = this.speedX.toJSON();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.scaleY)
|
|
|
|
{
|
|
|
|
delete output.scaleX;
|
|
|
|
output.scale = this.scaleX.toJSON();
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
2017-10-23 16:11:13 +00:00
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#startFollow
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} target - [description]
|
|
|
|
* @param {number} offsetX - [description]
|
|
|
|
* @param {number} offsetY - [description]
|
|
|
|
* @param {boolean} trackVisible - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-20 13:13:48 +00:00
|
|
|
startFollow: function (target, offsetX, offsetY, trackVisible)
|
2017-10-20 02:48:42 +00:00
|
|
|
{
|
2017-10-20 13:13:48 +00:00
|
|
|
if (offsetX === undefined) { offsetX = 0; }
|
|
|
|
if (offsetY === undefined) { offsetY = 0; }
|
|
|
|
if (trackVisible === undefined) { trackVisible = false; }
|
|
|
|
|
|
|
|
this.follow = target;
|
|
|
|
this.followOffset.set(offsetX, offsetY);
|
|
|
|
this.trackVisible = trackVisible;
|
2017-10-20 02:48:42 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#stopFollow
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-20 02:48:42 +00:00
|
|
|
stopFollow: function ()
|
|
|
|
{
|
2017-10-20 13:13:48 +00:00
|
|
|
this.follow = null;
|
|
|
|
this.followOffset.set(0, 0);
|
|
|
|
this.trackVisible = false;
|
2017-10-20 02:48:42 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#getFrame
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Textures.Frame} [description]
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
getFrame: function ()
|
|
|
|
{
|
2017-10-19 23:54:47 +00:00
|
|
|
if (this.frames.length === 1)
|
|
|
|
{
|
|
|
|
return this.defaultFrame;
|
|
|
|
}
|
2017-10-27 13:51:52 +00:00
|
|
|
else if (this.randomFrame)
|
2017-10-19 23:54:47 +00:00
|
|
|
{
|
|
|
|
return GetRandomElement(this.frames);
|
|
|
|
}
|
2017-10-27 13:51:52 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
var frame = this.frames[this.currentFrame];
|
|
|
|
|
|
|
|
this._frameCounter++;
|
|
|
|
|
|
|
|
if (this._frameCounter === this.frameQuantity)
|
|
|
|
{
|
|
|
|
this._frameCounter = 0;
|
|
|
|
this.currentFrame = Wrap(this.currentFrame + 1, 0, this._frameLength);
|
|
|
|
}
|
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
2017-10-18 14:18:42 +00:00
|
|
|
},
|
|
|
|
|
2017-10-27 13:51:52 +00:00
|
|
|
// frame: 0
|
|
|
|
// frame: 'red'
|
|
|
|
// frame: [ 0, 1, 2, 3 ]
|
|
|
|
// frame: [ 'red', 'green', 'blue', 'pink', 'white' ]
|
|
|
|
// frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] }
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {array|string|integer|object} frames - [description]
|
|
|
|
* @param {boolean} [pickRandom=true] - [description]
|
|
|
|
* @param {integer} [quantity=1] - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-27 13:51:52 +00:00
|
|
|
setFrame: function (frames, pickRandom, quantity)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-27 13:51:52 +00:00
|
|
|
if (pickRandom === undefined) { pickRandom = true; }
|
|
|
|
if (quantity === undefined) { quantity = 1; }
|
|
|
|
|
|
|
|
this.randomFrame = pickRandom;
|
|
|
|
this.frameQuantity = quantity;
|
|
|
|
this.currentFrame = 0;
|
|
|
|
this._frameCounter = 0;
|
|
|
|
|
|
|
|
var t = typeof (frames);
|
|
|
|
|
|
|
|
if (Array.isArray(frames) || t === 'string' || t === 'number')
|
|
|
|
{
|
|
|
|
this.manager.setEmitterFrames(frames, this);
|
|
|
|
}
|
|
|
|
else if (t === 'object')
|
|
|
|
{
|
|
|
|
var frameConfig = frames;
|
|
|
|
var frames = GetFastValue(frameConfig, 'frames', null);
|
|
|
|
|
|
|
|
if (frames)
|
|
|
|
{
|
|
|
|
this.manager.setEmitterFrames(frames, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
var isCycle = GetFastValue(frameConfig, 'cycle', false);
|
|
|
|
|
|
|
|
this.randomFrame = (isCycle) ? false : true;
|
|
|
|
|
|
|
|
this.frameQuantity = GetFastValue(frameConfig, 'quantity', quantity);
|
|
|
|
}
|
|
|
|
|
|
|
|
this._frameLength = this.frames.length;
|
|
|
|
|
|
|
|
if (this._frameLength === 1)
|
|
|
|
{
|
|
|
|
this.frameQuantity = 1;
|
|
|
|
this.randomFrame = false;
|
|
|
|
}
|
2017-10-18 14:18:42 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setRadial
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {boolean} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
setRadial: function (value)
|
|
|
|
{
|
|
|
|
if (value === undefined) { value = true; }
|
|
|
|
|
|
|
|
this.radial = value;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} x - [description]
|
|
|
|
* @param {number} y - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
setPosition: function (x, y)
|
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.x.onChange(x);
|
|
|
|
this.y.onChange(y);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setBounds
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number|object} x - [description]
|
|
|
|
* @param {number} y - [description]
|
|
|
|
* @param {number} width - [description]
|
|
|
|
* @param {number} height - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-25 01:25:06 +00:00
|
|
|
setBounds: function (x, y, width, height)
|
|
|
|
{
|
|
|
|
if (typeof x === 'object')
|
|
|
|
{
|
|
|
|
var obj = x;
|
|
|
|
|
|
|
|
var x = obj.x;
|
|
|
|
var y = obj.y;
|
2017-10-30 02:23:08 +00:00
|
|
|
var width = (HasValue(obj, 'w')) ? obj.w : obj.width;
|
|
|
|
var height = (HasValue(obj, 'h')) ? obj.h : obj.height;
|
2017-10-25 01:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this.bounds)
|
|
|
|
{
|
|
|
|
this.bounds.setTo(x, y, width, height);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this.bounds = new Rectangle(x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setSpeedX: function (value)
|
|
|
|
{
|
|
|
|
this.speedX.onChange(value);
|
|
|
|
|
|
|
|
// If you specify speedX and Y then it changes the emitter from radial to a point emitter
|
|
|
|
this.radial = false;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setSpeedY: function (value)
|
|
|
|
{
|
2017-10-30 02:23:08 +00:00
|
|
|
if (this.speedY)
|
|
|
|
{
|
|
|
|
this.speedY.onChange(value);
|
2017-10-24 02:02:03 +00:00
|
|
|
|
2017-10-30 02:23:08 +00:00
|
|
|
// If you specify speedX and Y then it changes the emitter from radial to a point emitter
|
|
|
|
this.radial = false;
|
|
|
|
}
|
2017-10-24 02:02:03 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setSpeed: function (value)
|
|
|
|
{
|
|
|
|
this.speedX.onChange(value);
|
|
|
|
this.speedY = null;
|
|
|
|
|
|
|
|
// If you specify speedX and Y then it changes the emitter from radial to a point emitter
|
2017-10-30 02:23:08 +00:00
|
|
|
this.radial = true;
|
2017-10-24 02:02:03 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setScaleX: function (value)
|
|
|
|
{
|
|
|
|
this.scaleX.onChange(value);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setScaleY: function (value)
|
|
|
|
{
|
|
|
|
this.scaleY.onChange(value);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setScale
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setScale: function (value)
|
|
|
|
{
|
|
|
|
this.scaleX.onChange(value);
|
|
|
|
this.scaleY = null;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityX
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setGravityX: function (value)
|
2017-10-17 20:32:45 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.gravityX = value;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityY
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setGravityY: function (value)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.gravityY = value;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setGravity
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} x - [description]
|
|
|
|
* @param {number} y - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-18 01:26:15 +00:00
|
|
|
setGravity: function (x, y)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.gravityX = x;
|
|
|
|
this.gravityY = y;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {float} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setAlpha: function (value)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.alpha.onChange(value);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setEmitterAngle: function (value)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-24 02:31:54 +00:00
|
|
|
this.angle.onChange(value);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setAngle: function (value)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.angle.onChange(value);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-17 20:32:45 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} value - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-24 02:02:03 +00:00
|
|
|
setLifespan: function (value)
|
2017-10-17 20:32:45 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.lifespan.onChange(value);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {integer} quantity - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-19 23:54:47 +00:00
|
|
|
setQuantity: function (quantity)
|
|
|
|
{
|
2017-10-24 02:31:54 +00:00
|
|
|
this.quantity.onChange(quantity);
|
2017-10-19 23:54:47 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} frequency - [description]
|
|
|
|
* @param {integer} [quantity] - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-19 23:54:47 +00:00
|
|
|
setFrequency: function (frequency, quantity)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
this.frequency = frequency;
|
2017-10-19 23:54:47 +00:00
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
this._counter = 0;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-19 23:54:47 +00:00
|
|
|
if (quantity)
|
|
|
|
{
|
2017-10-24 02:31:54 +00:00
|
|
|
this.quantity.onChange(quantity);
|
2017-10-19 23:54:47 +00:00
|
|
|
}
|
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* The zone must have a function called `getPoint` that takes a particle object and sets
|
|
|
|
* its x and y properties accordingly then returns that object.
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} zoneConfig - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-29 21:46:41 +00:00
|
|
|
setEmitZone: function (zoneConfig)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-29 21:46:41 +00:00
|
|
|
if (zoneConfig === undefined)
|
2017-10-18 14:18:42 +00:00
|
|
|
{
|
2017-10-29 21:46:41 +00:00
|
|
|
this.emitZone = null;
|
2017-10-18 14:18:42 +00:00
|
|
|
}
|
2017-10-26 16:02:34 +00:00
|
|
|
else
|
2017-10-18 14:18:42 +00:00
|
|
|
{
|
2017-10-26 16:02:34 +00:00
|
|
|
// Where source = Geom like Circle, or a Path or Curve
|
2017-10-29 21:46:41 +00:00
|
|
|
// emitZone: { type: 'random', source: X }
|
2017-11-01 13:09:30 +00:00
|
|
|
// emitZone: { type: 'edge', source: X, quantity: 32, [stepRate=0], [yoyo=false], [seamless=true] }
|
2017-10-26 16:02:34 +00:00
|
|
|
|
2017-10-29 21:46:41 +00:00
|
|
|
var type = GetFastValue(zoneConfig, 'type', 'random');
|
|
|
|
var source = GetFastValue(zoneConfig, 'source', null);
|
2017-10-26 16:02:34 +00:00
|
|
|
|
|
|
|
if (source && typeof source.getPoint === 'function')
|
|
|
|
{
|
2017-10-27 10:43:55 +00:00
|
|
|
switch (type)
|
2017-10-26 16:02:34 +00:00
|
|
|
{
|
2017-10-27 10:43:55 +00:00
|
|
|
case 'random':
|
2017-11-01 13:09:30 +00:00
|
|
|
|
2017-10-29 21:46:41 +00:00
|
|
|
this.emitZone = new RandomZone(source);
|
2017-11-01 13:09:30 +00:00
|
|
|
|
2017-10-27 10:43:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'edge':
|
2017-11-01 13:09:30 +00:00
|
|
|
|
2017-10-29 21:46:41 +00:00
|
|
|
var quantity = GetFastValue(zoneConfig, 'quantity', 1);
|
|
|
|
var stepRate = GetFastValue(zoneConfig, 'stepRate', 0);
|
|
|
|
var yoyo = GetFastValue(zoneConfig, 'yoyo', false);
|
2017-11-01 13:09:30 +00:00
|
|
|
var seamless = GetFastValue(zoneConfig, 'seamless', true);
|
|
|
|
|
|
|
|
this.emitZone = new EdgeZone(source, quantity, stepRate, yoyo, seamless);
|
|
|
|
|
2017-10-27 10:43:55 +00:00
|
|
|
break;
|
2017-10-26 16:02:34 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-18 14:18:42 +00:00
|
|
|
}
|
2017-10-17 03:16:52 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} zoneConfig - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-29 21:46:41 +00:00
|
|
|
setDeathZone: function (zoneConfig)
|
|
|
|
{
|
|
|
|
if (zoneConfig === undefined)
|
|
|
|
{
|
|
|
|
this.deathZone = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-06 22:25:23 +00:00
|
|
|
// Where source = Geom like Circle or Rect that supports a 'contains' function
|
2017-10-29 21:46:41 +00:00
|
|
|
// deathZone: { type: 'onEnter', source: X }
|
|
|
|
// deathZone: { type: 'onLeave', source: X }
|
|
|
|
|
|
|
|
var type = GetFastValue(zoneConfig, 'type', 'onEnter');
|
|
|
|
var source = GetFastValue(zoneConfig, 'source', null);
|
|
|
|
|
|
|
|
if (source && typeof source.contains === 'function')
|
|
|
|
{
|
|
|
|
var killOnEnter = (type === 'onEnter') ? true : false;
|
|
|
|
|
|
|
|
this.deathZone = new DeathZone(source, killOnEnter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#reserve
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {integer} particleCount - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
reserve: function (particleCount)
|
|
|
|
{
|
|
|
|
var dead = this.dead;
|
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
for (var i = 0; i < particleCount; i++)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-21 04:05:51 +00:00
|
|
|
dead.push(new this.particleClass(this));
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {integer} The number of currently alive Particles in this Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
getAliveParticleCount: function ()
|
|
|
|
{
|
|
|
|
return this.alive.length;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {integer} The number of currently dead Particles in this Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
getDeadParticleCount: function ()
|
|
|
|
{
|
|
|
|
return this.dead.length;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {integer} The number of Particles in this Emitter, including both alive and dead.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
getParticleCount: function ()
|
|
|
|
{
|
|
|
|
return this.getAliveParticleCount() + this.getDeadParticleCount();
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#atLimit
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {boolean} Returns `true` if this Emitter is at its limit, or `false` if no limit, or below the `maxParticles` level.
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
atLimit: function ()
|
|
|
|
{
|
|
|
|
return (this.maxParticles > 0 && this.getParticleCount() === this.maxParticles);
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} callback - [description]
|
|
|
|
* @param {[type]} context - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-21 04:05:51 +00:00
|
|
|
onParticleEmit: function (callback, context)
|
|
|
|
{
|
|
|
|
if (callback === undefined)
|
|
|
|
{
|
|
|
|
// Clear any previously set callback
|
|
|
|
this.emitCallback = null;
|
|
|
|
this.emitCallbackScope = null;
|
|
|
|
}
|
|
|
|
else if (typeof callback === 'function')
|
|
|
|
{
|
|
|
|
this.emitCallback = callback;
|
|
|
|
|
|
|
|
if (context)
|
|
|
|
{
|
|
|
|
this.emitCallbackScope = context;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} callback - [description]
|
|
|
|
* @param {[type]} context - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
onParticleDeath: function (callback, context)
|
|
|
|
{
|
|
|
|
if (callback === undefined)
|
|
|
|
{
|
|
|
|
// Clear any previously set callback
|
|
|
|
this.deathCallback = null;
|
|
|
|
this.deathCallbackScope = null;
|
|
|
|
}
|
|
|
|
else if (typeof callback === 'function')
|
|
|
|
{
|
|
|
|
this.deathCallback = callback;
|
|
|
|
|
|
|
|
if (context)
|
|
|
|
{
|
|
|
|
this.deathCallbackScope = context;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#killAll
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
killAll: function ()
|
|
|
|
{
|
|
|
|
var dead = this.dead;
|
|
|
|
var alive = this.alive;
|
|
|
|
|
|
|
|
while (alive.length > 0)
|
|
|
|
{
|
|
|
|
dead.push(alive.pop());
|
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} callback - [description]
|
|
|
|
* @param {[type]} thisArg - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
forEachAlive: function (callback, thisArg)
|
|
|
|
{
|
|
|
|
var alive = this.alive;
|
|
|
|
var length = alive.length;
|
|
|
|
|
|
|
|
for (var index = 0; index < length; ++index)
|
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
// Sends the Particle and the Emitter
|
|
|
|
callback.call(thisArg, alive[index], this);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} callback - [description]
|
|
|
|
* @param {[type]} thisArg - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
forEachDead: function (callback, thisArg)
|
|
|
|
{
|
|
|
|
var dead = this.dead;
|
|
|
|
var length = dead.length;
|
|
|
|
|
|
|
|
for (var index = 0; index < length; ++index)
|
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
// Sends the Particle and the Emitter
|
|
|
|
callback.call(thisArg, dead[index], this);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#start
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
start: function ()
|
|
|
|
{
|
|
|
|
this.on = true;
|
|
|
|
|
|
|
|
this._counter = 0;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#pause
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
pause: function ()
|
|
|
|
{
|
|
|
|
this.active = false;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#resume
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
resume: function ()
|
|
|
|
{
|
|
|
|
this.active = true;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#depthSort
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-21 04:05:51 +00:00
|
|
|
depthSort: function ()
|
|
|
|
{
|
|
|
|
StableSort.inplace(this.alive, this.depthSortCallback);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#flow
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} frequency - [description]
|
|
|
|
* @param {integer} [count=1] - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
flow: function (frequency, count)
|
|
|
|
{
|
|
|
|
if (count === undefined) { count = 1; }
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
this.frequency = frequency;
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2017-10-24 02:31:54 +00:00
|
|
|
this.quantity.onChange(count);
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
return this.start();
|
|
|
|
},
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#explode
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {integer} count - The amount of Particles to emit.
|
|
|
|
* @param {number} x - The x coordinate to emit the Particles from.
|
|
|
|
* @param {number} y - The y coordinate to emit the Particles from.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
|
|
|
*/
|
2017-10-18 14:18:42 +00:00
|
|
|
explode: function (count, x, y)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
this.frequency = -1;
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-01-12 17:09:09 +00:00
|
|
|
return this.emitParticle(count, x, y);
|
2017-10-17 03:16:52 +00:00
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} x - The x coordinate to emit the Particles from.
|
|
|
|
* @param {number} y - The y coordinate to emit the Particles from.
|
|
|
|
* @param {integer} count - The amount of Particles to emit.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
|
|
|
*/
|
2018-01-12 17:09:09 +00:00
|
|
|
emitParticleAt: function (x, y, count)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2018-01-12 17:09:09 +00:00
|
|
|
return this.emitParticle(count, x, y);
|
2017-10-18 14:18:42 +00:00
|
|
|
},
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {integer} count - The amount of Particles to emit.
|
|
|
|
* @param {number} x - The x coordinate to emit the Particles from.
|
|
|
|
* @param {number} y - The y coordinate to emit the Particles from.
|
|
|
|
*
|
|
|
|
* @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle.
|
|
|
|
*/
|
2018-01-12 17:09:09 +00:00
|
|
|
emitParticle: function (count, x, y)
|
2017-10-18 14:18:42 +00:00
|
|
|
{
|
|
|
|
if (this.atLimit())
|
|
|
|
{
|
2017-10-21 04:05:51 +00:00
|
|
|
return;
|
2017-10-18 14:18:42 +00:00
|
|
|
}
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-24 02:31:54 +00:00
|
|
|
if (count === undefined)
|
|
|
|
{
|
|
|
|
count = this.quantity.onEmit();
|
|
|
|
}
|
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
var dead = this.dead;
|
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
for (var i = 0; i < count; i++)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
var particle;
|
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
if (dead.length > 0)
|
|
|
|
{
|
|
|
|
particle = dead.pop();
|
2017-10-18 14:18:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-21 04:05:51 +00:00
|
|
|
particle = new this.particleClass(this);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2018-01-12 17:09:09 +00:00
|
|
|
particle.fire(x, y);
|
2017-10-18 14:18:42 +00:00
|
|
|
|
|
|
|
if (this.particleBringToTop)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
this.alive.push(particle);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
this.alive.unshift(particle);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
|
2017-10-21 04:05:51 +00:00
|
|
|
if (this.emitCallback)
|
|
|
|
{
|
|
|
|
this.emitCallback.call(this.emitCallbackScope, particle, this);
|
|
|
|
}
|
2017-10-17 20:32:45 +00:00
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
if (this.atLimit())
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
|
|
|
|
2017-10-21 04:05:51 +00:00
|
|
|
return particle;
|
2017-10-17 03:16:52 +00:00
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {[type]} time - [description]
|
|
|
|
* @param {[type]} delta - [description]
|
|
|
|
*/
|
2017-10-17 03:16:52 +00:00
|
|
|
preUpdate: function (time, delta)
|
|
|
|
{
|
2017-10-17 20:32:45 +00:00
|
|
|
// Scale the delta
|
|
|
|
delta *= this.timeScale;
|
|
|
|
|
2017-10-18 14:18:42 +00:00
|
|
|
var step = (delta / 1000);
|
2017-10-20 02:48:42 +00:00
|
|
|
|
2017-10-24 02:02:03 +00:00
|
|
|
if (this.trackVisible)
|
2017-10-20 02:48:42 +00:00
|
|
|
{
|
2017-10-24 02:02:03 +00:00
|
|
|
this.visible = this.follow.visible;
|
2017-10-20 02:48:42 +00:00
|
|
|
}
|
|
|
|
|
2017-10-25 15:05:35 +00:00
|
|
|
// Any particle processors?
|
|
|
|
var processors = this.manager.getProcessors();
|
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
var particles = this.alive;
|
|
|
|
var length = particles.length;
|
2017-10-17 20:32:45 +00:00
|
|
|
|
|
|
|
for (var index = 0; index < length; index++)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
|
|
|
var particle = particles[index];
|
|
|
|
|
2017-10-17 20:32:45 +00:00
|
|
|
// update returns `true` if the particle is now dead (lifeStep < 0)
|
2017-10-25 15:05:35 +00:00
|
|
|
if (particle.update(delta, step, processors))
|
2017-10-17 20:32:45 +00:00
|
|
|
{
|
|
|
|
// Moves the dead particle to the end of the particles array (ready for splicing out later)
|
|
|
|
var last = particles[length - 1];
|
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
particles[length - 1] = particle;
|
|
|
|
particles[index] = last;
|
2017-10-18 14:18:42 +00:00
|
|
|
|
2017-10-17 03:16:52 +00:00
|
|
|
index -= 1;
|
|
|
|
length -= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Move dead particles to the dead array
|
|
|
|
var deadLength = particles.length - length;
|
|
|
|
|
|
|
|
if (deadLength > 0)
|
|
|
|
{
|
2017-10-18 14:18:42 +00:00
|
|
|
var rip = particles.splice(particles.length - deadLength, deadLength);
|
|
|
|
|
|
|
|
var deathCallback = this.deathCallback;
|
|
|
|
var deathCallbackScope = this.deathCallbackScope;
|
|
|
|
|
|
|
|
if (deathCallback)
|
|
|
|
{
|
|
|
|
for (var i = 0; i < rip.length; i++)
|
|
|
|
{
|
|
|
|
deathCallback.call(deathCallbackScope, rip[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.dead.concat(rip);
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-21 04:05:51 +00:00
|
|
|
StableSort.inplace(particles, this.indexSortCallback);
|
2017-10-17 03:16:52 +00:00
|
|
|
}
|
2017-10-21 04:05:51 +00:00
|
|
|
|
2017-10-19 23:54:47 +00:00
|
|
|
if (!this.on)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.frequency === 0)
|
|
|
|
{
|
2018-01-12 17:09:09 +00:00
|
|
|
this.emitParticle();
|
2017-10-19 23:54:47 +00:00
|
|
|
}
|
|
|
|
else if (this.frequency > 0)
|
2017-10-18 14:18:42 +00:00
|
|
|
{
|
|
|
|
this._counter -= delta;
|
|
|
|
|
|
|
|
if (this._counter <= 0)
|
|
|
|
{
|
2018-01-12 17:09:09 +00:00
|
|
|
this.emitParticle();
|
2017-10-17 03:16:52 +00:00
|
|
|
|
2017-10-19 23:54:47 +00:00
|
|
|
// counter = frequency - remained from previous delta
|
|
|
|
this._counter = (this.frequency - Math.abs(this._counter));
|
2017-10-18 14:18:42 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-17 03:16:52 +00:00
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} a - [description]
|
|
|
|
* @param {object} b - [description]
|
|
|
|
*
|
|
|
|
* @return {integer} [description]
|
|
|
|
*/
|
2017-10-21 04:05:51 +00:00
|
|
|
depthSortCallback: function (a, b)
|
|
|
|
{
|
|
|
|
return a.y - b.y;
|
|
|
|
},
|
|
|
|
|
2018-02-06 22:25:23 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.GameObjects.Particles.ParticleEmitter#indexSortCallback
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} a - [description]
|
|
|
|
* @param {object} b - [description]
|
|
|
|
*
|
|
|
|
* @return {integer} [description]
|
|
|
|
*/
|
2017-10-21 04:05:51 +00:00
|
|
|
indexSortCallback: function (a, b)
|
2017-10-17 03:16:52 +00:00
|
|
|
{
|
|
|
|
return a.index - b.index;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = ParticleEmitter;
|