export class SoundManager {
    constructor(instance, soundSet) {
        this.instance = instance;
        this.soundSet = soundSet;
    }
    setSoundSet(soundSet) {
        this.soundSet = soundSet;
    }
    init() {
        this.instance.subscribe('character.appear', this.handleCharacterAppear.bind(this));
        this.instance.subscribe('open', this.handleOpen.bind(this));
        this.instance.subscribe('close', this.handleClose.bind(this));
        this.instance.subscribe('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();
    }
}
