let instance;

/**
 * 统一的音效管理器
 */
export default class Music {
  boomAudio = wx.createInnerAudioContext();
  shootAudio = wx.createInnerAudioContext();

  constructor() {
    if (instance) return instance;

    instance = this;

    this.boomAudio.src = 'audio/boom2.mp3';
    this.shootAudio.src = 'audio/gu.mp3';
  }

  playShoot() {
    this.shootAudio.currentTime = 0;
    this.shootAudio.play();
  }

  playExplosion() {
    this.boomAudio.currentTime = 0;
    this.boomAudio.play();
  }
}
