44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Godot;
|
|
|
|
namespace Gmtk24 {
|
|
public partial class UserSettings : Node {
|
|
/// <summary>The singleton instance of this class, set when Godot
|
|
/// instantiates the Autoload scripts.</summary>
|
|
public static UserSettings Singleton { get; private set; }
|
|
|
|
public float Volume { get; private set; }
|
|
|
|
public float CameraSensitivityX = 2f;
|
|
public float CameraSensitivityY = 2f;
|
|
public bool CameraInvertX = false;
|
|
public bool CameraInvertY = false;
|
|
|
|
public float TableOrbitSpeedX = 1f;
|
|
public float TableOrbitSpeedY = 1f;
|
|
public bool TableOrbitInvertX = false;
|
|
public bool TableOrbitInvertY = false;
|
|
|
|
public override void _Ready() {
|
|
SetVolume(0.2f);
|
|
Singleton = this;
|
|
}
|
|
|
|
public Vector2 GetCameraSpeedMultipliers() {
|
|
var x = CameraSensitivityX * (CameraInvertX ? -1 : 1);
|
|
var y = CameraSensitivityY * (CameraInvertY ? -1 : 1);
|
|
return new Vector2(x, y);
|
|
}
|
|
|
|
public Vector2 GetOrbitSpeedMultipliers() {
|
|
var x = TableOrbitSpeedX * (TableOrbitInvertX ? -1 : 1);
|
|
var y = TableOrbitSpeedY * (TableOrbitInvertY ? -1 : 1);
|
|
return new Vector2(x, y);
|
|
}
|
|
|
|
public void SetVolume(float volume) {
|
|
AudioServer.SetBusVolumeDb(0, volume == 0 ? -80 : Mathf.LinearToDb(volume));
|
|
Volume = volume;
|
|
}
|
|
}
|
|
}
|