export class SoundManager { constructor(instance, soundSet) { this.instance = instance; this.soundSet = soundSet; } setSoundSet(soundSet) { this.soundSet = soundSet; } init() { this.instance.on('character.appear', this.handleCharacterAppear.bind(this)); this.instance.on('open', this.handleOpen.bind(this)); this.instance.on('close', this.handleClose.bind(this)); this.instance.on('advance', this.handleAdvance.bind(this)); } handleOpen() { this.soundSet.open && this.soundSet.open.play(); } handleCharacterAppear() { this.soundSet.characterAppear && this.soundSet.characterAppear.play(); } handleAdvance() { this.soundSet.scroll && this.soundSet.scroll.play(); } handleClose() { this.soundSet.close && this.soundSet.close.play(); } }