mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
Simplified logic for removal of destroyed sounds
This commit is contained in:
parent
efbf276dc9
commit
7c2bd98e44
1 changed files with 2 additions and 6 deletions
|
@ -198,13 +198,9 @@ var BaseSoundManager = new Class({
|
||||||
* @param {number} delta - The delta time elapsed since the last frame.
|
* @param {number} delta - The delta time elapsed since the last frame.
|
||||||
*/
|
*/
|
||||||
update: function (time, delta) {
|
update: function (time, delta) {
|
||||||
this.sounds.sort(function (s1, s2) {
|
for (var i = this.sounds.length - 1; i >= 0; i--) {
|
||||||
return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1;
|
|
||||||
});
|
|
||||||
for (var i = 0; i < this.sounds.length; i++) {
|
|
||||||
if (this.sounds[i].pendingRemove) {
|
if (this.sounds[i].pendingRemove) {
|
||||||
this.sounds.length = i;
|
this.sounds.splice(i, 1);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.sounds.forEach(function (sound) {
|
this.sounds.forEach(function (sound) {
|
||||||
|
|
Loading…
Reference in a new issue