Clones get ref to parent’s activeSoundPlayers obj

This commit is contained in:
Eric Rosenbaum 2018-03-19 16:44:49 -04:00
parent 4c0e968bec
commit 2527c804ea

View file

@ -146,6 +146,13 @@ class RenderedTarget extends Target {
this.audioPlayer = null;
if (this.runtime && this.runtime.audioEngine) {
this.audioPlayer = this.runtime.audioEngine.createPlayer();
// If this is a clone, it gets a reference to its parent's activeSoundPlayers object.
if (!this.isOriginal) {
const parent = this.sprite.clones[0];
if (parent && parent.audioPlayer) {
this.audioPlayer.activeSoundPlayers = parent.audioPlayer.activeSoundPlayers;
}
}
}
}