mirror of
https://github.com/RYGhub/the-cold-night.git
synced 2024-11-24 05:34:18 +00:00
🔧 Make mute button mute sounds as well
This commit is contained in:
parent
f3b7c4a92e
commit
86efa55c12
1 changed files with 11 additions and 9 deletions
|
@ -7,26 +7,28 @@ export var bell_min: float = 0.20
|
|||
export var bell_max: float = 0.60
|
||||
export var drum_min: float = 0.40
|
||||
export var drum_max: float = 0.80
|
||||
export var muted: bool = false setget set_mute
|
||||
export var muted: bool setget set_mute, get_mute
|
||||
|
||||
|
||||
func _on_Fire_intensity_changed(value):
|
||||
$Choir.volume_db = (smoothstep(choir_min, choir_max, value) - 1) * 60
|
||||
$Choir.bus = "Master" if not muted and $Choir.volume_db > -60 else "Mute"
|
||||
$Choir.bus = "Master" if $Choir.volume_db > -60 else "Mute"
|
||||
|
||||
$Bell.volume_db = (smoothstep(bell_min, bell_max, value) - 1) * 60
|
||||
$Bell.bus = "Master" if not muted and $Bell.volume_db > -60 else "Mute"
|
||||
$Bell.bus = "Master" if $Bell.volume_db > -60 else "Mute"
|
||||
|
||||
$Drum.volume_db = (smoothstep(drum_min, drum_max, value) - 1) * 60
|
||||
$Drum.bus = "Master" if not muted and $Drum.volume_db > -60 else "Mute"
|
||||
$Drum.bus = "Master" if $Drum.volume_db > -60 else "Mute"
|
||||
|
||||
|
||||
func set_mute(value):
|
||||
muted = value
|
||||
$Choir.bus = "Master" if not muted and $Choir.volume_db > -60 else "Mute"
|
||||
$Bell.bus = "Master" if not muted and $Bell.volume_db > -60 else "Mute"
|
||||
$Drum.bus = "Master" if not muted and $Drum.volume_db > -60 else "Mute"
|
||||
var index = AudioServer.get_bus_index("Master")
|
||||
AudioServer.set_bus_mute(index, value)
|
||||
|
||||
func get_mute():
|
||||
var index = AudioServer.get_bus_index("Master")
|
||||
return AudioServer.is_bus_mute(index)
|
||||
|
||||
|
||||
func _on_MuteButton_pressed():
|
||||
set_mute(not muted)
|
||||
set_mute(not get_mute())
|
||||
|
|
Loading…
Reference in a new issue