|
|
@ -36,22 +36,21 @@ Sound.prototype.playBgm = function () { |
|
|
|
}; |
|
|
|
|
|
|
|
Sound.prototype.playFootsteps = function () { |
|
|
|
console.log('播放脚步声: ', this.music.audio2); |
|
|
|
this.music.audio2 && this.music.audio2.play({ loop: -1 }); // 播放脚步声
|
|
|
|
}; |
|
|
|
|
|
|
|
Sound.prototype.pauseFootsteps = function () { |
|
|
|
this.music.audio2 && this.music.audio2.pause(); // 停止脚步声
|
|
|
|
console.log('停止脚步声: ', this.music.audio2); |
|
|
|
this.music.audio2 && this.music.audio2.stop(); // 停止脚步声
|
|
|
|
console.log('停止脚步声: '); |
|
|
|
}; |
|
|
|
|
|
|
|
Sound.prototype.playBomb = function (direction) { |
|
|
|
if (direction === 0 || direction === 1) { |
|
|
|
this.music.audio1 && this.music.audio1.play(); // 播放跨栏声
|
|
|
|
this.music.audio2.paused = true; |
|
|
|
this.pauseFootsteps(); |
|
|
|
} |
|
|
|
const _this = this; |
|
|
|
setTimeout(function () { |
|
|
|
_this.music.audio2.paused = false; |
|
|
|
}, 2000); |
|
|
|
_this.playFootsteps(); |
|
|
|
}, 1000); |
|
|
|
}; |
|
|
|