diff --git a/to6trvr3fj.js b/to6trvr3fj.js index 8bc9399..294e4fb 100644 --- a/to6trvr3fj.js +++ b/to6trvr3fj.js @@ -181,12 +181,50 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { console.log('exploding enemy'); enemy.exploding = true; + var sound = GameLib.Utils.GetRandomIntInclusive(1,3); + + var name = 'Audio - Blast 1'; + + if (sound === 2) { + name = 'Audio - Blast 2'; + } + + if (sound === 3) { + name = 'Audio - Blast 3'; + } + + this.blastSubscription = GameLib.Event.Subscribe( + GameLib.Event.AUDIO_ENDED, + function(data) { + + if (this.blastSubscription) { + + this.blastSubscription.remove(); + + this.blastSubscription = null; + + if (data.name === name) { + GameLib.Event.Emit( + GameLib.Event.PLAY_AUDIO, + { + name : 'Audio - Ho ho ho' + } + ); + } + + + } + }.bind(this) + ); + GameLib.Event.Emit( GameLib.Event.PLAY_AUDIO, { - name : 'Audio - Ho ho ho' + name : name } ); + + // var particleEngine = this.smokeParticleEngine.clone(); // particleEngine.position = mesh.position.clone(); // particleEngine.updateInstance('position');