|
@@ -1,5 +1,8 @@
|
|
|
function bgm_play(_key)
|
|
function bgm_play(_key)
|
|
|
{
|
|
{
|
|
|
|
|
+ if !global.audio_enabled
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
var _mus = oAudioManager.bgm_map[$ _key];
|
|
var _mus = oAudioManager.bgm_map[$ _key];
|
|
|
if _mus == undefined exit;
|
|
if _mus == undefined exit;
|
|
|
|
|
|
|
@@ -12,12 +15,18 @@ function bgm_play(_key)
|
|
|
|
|
|
|
|
function bgm_stop()
|
|
function bgm_stop()
|
|
|
{
|
|
{
|
|
|
|
|
+ if !global.audio_enabled
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
audio_stop_sound(oAudioManager.bgm_current);
|
|
audio_stop_sound(oAudioManager.bgm_current);
|
|
|
oAudioManager.bgm_current = noone;
|
|
oAudioManager.bgm_current = noone;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function sfx_play(_key, _pitch_vary = 0.1, _vol_vary = 0.1)
|
|
function sfx_play(_key, _pitch_vary = 0.1, _vol_vary = 0.1)
|
|
|
{
|
|
{
|
|
|
|
|
+ if !global.audio_enabled
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
var _sfx = oAudioManager.sfx_map[$ _key];
|
|
var _sfx = oAudioManager.sfx_map[$ _key];
|
|
|
var _inst = audio_play_sound(_sfx, 1, false);
|
|
var _inst = audio_play_sound(_sfx, 1, false);
|
|
|
|
|
|
|
@@ -27,4 +36,24 @@ function sfx_play(_key, _pitch_vary = 0.1, _vol_vary = 0.1)
|
|
|
audio_sound_pitch(_inst, _pitch);
|
|
audio_sound_pitch(_inst, _pitch);
|
|
|
audio_sound_gain(_inst, _vol, 0);
|
|
audio_sound_gain(_inst, _vol, 0);
|
|
|
return _inst;
|
|
return _inst;
|
|
|
|
|
+}
|
|
|
|
|
+function sfx_heartbeat_play()
|
|
|
|
|
+{
|
|
|
|
|
+ if !global.audio_enabled
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ var _threshold = 2;
|
|
|
|
|
+ if global.playerHP <= _threshold
|
|
|
|
|
+ {
|
|
|
|
|
+ var _vol = 1// - (global.playerHP / _threshold) * 0.5;
|
|
|
|
|
+ audio_sound_gain(heartbeat_sound, _vol, 100);
|
|
|
|
|
+
|
|
|
|
|
+ var _bgm_vol = oAudioManager.bgm_volume * (1 - _vol * 0.7);
|
|
|
|
|
+ audio_sound_gain(oAudioManager.bgm_current, _bgm_vol, 100);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ audio_sound_gain(heartbeat_sound, 0, 200);
|
|
|
|
|
+ audio_sound_gain(oAudioManager.bgm_current, oAudioManager.bgm_volume, 200); // 恢复
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|