mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +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.
|
||||
*/
|
||||
update: function (time, delta) {
|
||||
this.sounds.sort(function (s1, s2) {
|
||||
return (s1.pendingRemove === s2.pendingRemove) ? 0 : s1 ? 1 : -1;
|
||||
});
|
||||
for (var i = 0; i < this.sounds.length; i++) {
|
||||
for (var i = this.sounds.length - 1; i >= 0; i--) {
|
||||
if (this.sounds[i].pendingRemove) {
|
||||
this.sounds.length = i;
|
||||
break;
|
||||
this.sounds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
this.sounds.forEach(function (sound) {
|
||||
|
|
Loading…
Reference in a new issue