Lower music volume when paused

This commit is contained in:
Mario Martínez 2024-10-09 13:20:44 +02:00
parent 6a547258d3
commit c2d1a6a127
2 changed files with 3 additions and 6 deletions

View file

@ -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:

View file

@ -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"]