From c2d1a6a127a46edc206934f8cffc6e29bab721d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Mart=C3=ADnez=20Palacio?= Date: Wed, 9 Oct 2024 13:20:44 +0200 Subject: [PATCH] Lower music volume when paused --- Scripts/Audio/music_manager.gd | 8 ++------ world/world.tscn | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Scripts/Audio/music_manager.gd b/Scripts/Audio/music_manager.gd index 1b2215c..eb29fab 100644 --- a/Scripts/Audio/music_manager.gd +++ b/Scripts/Audio/music_manager.gd @@ -16,12 +16,8 @@ func play_music(audio: AudioStream, crossfade = true): _tracks[_current].stream = audio _tracks[_current].play() -func _on_game_paused(): - _tracks[_current].volume_db = -10.0 - -func _on_game_unpaused(): - _tracks[_current].volume_db = 0.0 - +func _on_game_pause_toggled(paused: bool): + _tracks[_current].volume_db = -10.0 if paused else 0.0 func _on_cutscene_issued_command(command: CutsceneCommand, manager: CutsceneManager): if command is CueBGMCommand: diff --git a/world/world.tscn b/world/world.tscn index 503a67d..0035174 100644 --- a/world/world.tscn +++ b/world/world.tscn @@ -279,4 +279,5 @@ script = ExtResource("24_6ypry") [connection signal="defeated" from="ReedAI" to="." method="_on_ai_defeated"] [connection signal="got_hurt" from="ReedAI" to="CanvasLayer/BattleUI" method="_on_enemy_got_hurt"] [connection signal="game_pause_toggled" from="GameState" to="PauseMenu" method="_on_game_pause_toggled"] +[connection signal="game_pause_toggled" from="GameState" to="MusicManager" method="_on_game_pause_toggled"] [connection signal="game_pause_toggled" from="GameState" to="SoundManager" method="_on_game_pause_toggled"]