mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Added remove method to fully nuke a tween from the manager.
This commit is contained in:
parent
a799f5abf0
commit
0897b78f8a
1 changed files with 23 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var ArrayRemove = require('../utils/array/Remove');
|
||||||
var Class = require('../utils/Class');
|
var Class = require('../utils/Class');
|
||||||
var NumberTweenBuilder = require('./builders/NumberTweenBuilder');
|
var NumberTweenBuilder = require('./builders/NumberTweenBuilder');
|
||||||
var PluginCache = require('../plugins/PluginCache');
|
var PluginCache = require('../plugins/PluginCache');
|
||||||
|
@ -374,6 +375,28 @@ var TweenManager = new Class({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the given tween from the Tween Manager, regardless of its state (pending or active).
|
||||||
|
*
|
||||||
|
* @method Phaser.Tweens.TweenManager#remove
|
||||||
|
* @since 3.17.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Tweens.Tween} tween - The Tween to be removed.
|
||||||
|
*
|
||||||
|
* @return {Phaser.Tweens.TweenManager} This Tween Manager object.
|
||||||
|
*/
|
||||||
|
remove: function (tween)
|
||||||
|
{
|
||||||
|
ArrayRemove(this._add, tween);
|
||||||
|
ArrayRemove(this._pending, tween);
|
||||||
|
ArrayRemove(this._active, tween);
|
||||||
|
ArrayRemove(this._destroy, tween);
|
||||||
|
|
||||||
|
tween.state = TWEEN_CONST.REMOVED;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't.
|
* Checks if a Tween or Timeline is active and adds it to the Tween Manager at the start of the frame if it isn't.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue