class Audio extends Phaser.Scene{constructor(){super("Audio")}init(){this.audFile,this.soundTimer,this.bgm,this.sfx,this.modal=this.scene.get("Modal")}preload(){}create(){log("=> launching Audio manager"),this.game.music.setVolume(.1),this.game.sfx.setVolume(.1),this.game.speech.setVolume(.5)}update(){}playBGM(s){log(this),this.bgm&&this.bgm.stop(),this.bgm=this.game.music.add(["bgm"+s]),this.bgm.setRate(1),this.bgm.play(),this.bgm.setLoop(!0)}stopBGM(){null!=this.bgm&&this.bgm.stop()}setBGMVolume(s){this.game.music.setVolume(s)}playSFX(s,e=1){this.sfx=this.game.sfx.add(s),this.sfx.setRate(e),this.sfx.play()}setSFXVolume(s){this.game.sfx.setVolume(s)}setSpeechVolume(s){this.game.speech.setVolume(s)}playSound(s,{loop:e=!1,blocksInputs:t=!1,stopsOther:i=!1}){this.audFile&&this.audFile.isPlaying&&i&&(this.audFile.stop(),clearTimeout(this.soundTimer),this.removeSoundKeys(this)),this.load.audio(s,"./assets/sounds/dialog/"+s+".mp3"),this.load.once(Phaser.Loader.Events.COMPLETE,(()=>{log("playing sound: ",s),this.audFile=this.game.speech.add(s),this.audFile.loop=e,this.audFile.setRate(1),this.audFile.play(),t&&this.modal.blockInputs(),e||(this.soundTimer=setTimeout((()=>{this.audFile.stop()}),999*Math.ceil(this.audFile.duration))),this.audFile.on("stop",(s=>{clearTimeout(this.soundTimer),t&&this.modal.blockInputs(!1)}))})),this.load.start()}stopSound(s){this.audFile.stop(s)}stopSounds(){this.audFile.stop()}removeSoundKeys(){var s=this;this.cache.audio.getKeys().forEach((function(e){log("removing ",e),s.cache.text.remove(e),s.cache.audio.remove(e),s.sound.remove(e)}))}}
//# sourceMappingURL=index.1ed16290.js.map
