First_Person_Slapper/Options.gd

61 lines
1.6 KiB
GDScript3
Raw Permalink Normal View History

2022-10-12 08:22:40 -04:00
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var MouseSensSlider = $MouseSensSlider
onready var SFXVol = $SFXSlider
onready var MusicVol = $MusicSlider
onready var MasterVol = $MasterVolSlider
onready var SFXBusName := "SFX"
onready var MusicBusName := "Music"
onready var MasterBusName := "Master"
onready var SFXBus := AudioServer.get_bus_index(SFXBusName)
onready var MusicBus := AudioServer.get_bus_index(MusicBusName)
onready var MasterBus := AudioServer.get_bus_index(MasterBusName)
# Called when the node enters the scene tree for the first time.
func _ready():
2022-10-12 12:21:18 -04:00
MouseSensSlider.value = get_tree().get_current_scene().get_node("Player").mouse_sensitivity
2022-10-12 08:22:40 -04:00
SFXVol.value = db2linear(AudioServer.get_bus_volume_db(SFXBus))
MusicVol.value = db2linear(AudioServer.get_bus_volume_db(MusicBus))
MasterVol.value = db2linear(AudioServer.get_bus_volume_db(MasterBus))
func _on_MouseSensSlider_value_changed(value):
2022-10-12 12:21:18 -04:00
get_tree().get_current_scene().get_node("Player").mouse_sensitivity = value
2022-10-12 08:22:40 -04:00
func _on_SFXSlider_value_changed(value):
AudioServer.set_bus_volume_db(SFXBus, linear2db(value))
func _on_MusicSlider_value_changed(value):
AudioServer.set_bus_volume_db(MusicBus, linear2db(value))
func _on_MasterVolSlider_value_changed(value):
AudioServer.set_bus_volume_db(MasterBus, linear2db(value))
func _on_MouseSensSlider_mouse_exited():
pass#MouseSensSlider.release_focus()
func _on_SFXSlider_mouse_exited():
pass#SFXVol.release_focus()
func _on_MusicSlider_mouse_exited():
pass#MusicVol.release_focus()
func _on_MasterVolSlider_mouse_exited():
pass#MasterVol.release_focus()