File: gameplay\movement\dashing\Components.js
/**
A component class that adds the ability to increase entity's movement speed.
@class Dashing
@constructor
@param dashingSpeedMultiplier {Number} This multiplier will be used to create a MovementSpeedSpellEffect, so the same rules apply. Since this component is responsible for dashing, this value should probably be greater than 1.
*/
function Dashing(dashingSpeedMultiplier){
this._dashingSpeedMultiplier = dashingSpeedMultiplier || 1;
this._timeSinceMovedLeft = Number.POSITIVE_INFINITY;
this._movedLeftThisFrame = false;
this._isDashingLeft = false;
this._timeSinceMovedRight = Number.POSITIVE_INFINITY;
this._movedRightThisFrame = false;
this._isDashingRight = false;
this._dashingSpellEffect = null;
}
Dashing.prototype = {
constructor : Dashing,
_componentIdentifier : 0,
/**
@method getDashingSpeedMultiplier
@return {Number}
*/
getDashingSpeedMultiplier : function(){
return this._dashingSpeedMultiplier;
},
/**
@method setDashingSpeedMultiplier
@param dashingSpeedMultiplier {Number} This multiplier will be used to create a MovementSpeedSpellEffect, so the same rules apply. Since this component is responsible for dashing, this value should probably be greater than 1.
*/
setDashingSpeedMultiplier : function(multiplier){
this._dashingSpeedMultiplier = multiplier;
},
/**
@method isDashing
@return {Boolean} True if the entity's currently in the dashing state, otherwise false.
*/
isDashing : function(){
return (this._isDashingLeft || this._isDashingRight);
}
};