SanAndreasUnity/Assets/Scripts/Settings/PlayerSettings.cs

57 lines
2 KiB
C#
Raw Normal View History

2020-05-31 17:07:22 +00:00
using System.Collections.Generic;
using UnityEngine;
using SanAndreasUnity.Behaviours;
using SanAndreasUnity.UI;
namespace SanAndreasUnity.Settings {
public class PlayerSettings : MonoBehaviour {
OptionsWindow.FloatInput m_turnSpeedInput = new OptionsWindow.FloatInput() {
description = "Turn speed",
minValue = 3,
maxValue = 30,
isAvailable = () => PedManager.Instance != null,
getValue = () => PedManager.Instance.pedTurnSpeed,
setValue = (value) => { PedManager.Instance.pedTurnSpeed = value; },
2019-06-23 00:04:01 +00:00
persistType = OptionsWindow.InputPersistType.OnStart,
2020-05-31 17:07:22 +00:00
};
OptionsWindow.BoolInput m_showSpeedometerInput = new OptionsWindow.BoolInput() {
description = "Show speedometer",
isAvailable = () => PedManager.Instance != null,
getValue = () => PedManager.Instance.showPedSpeedometer,
setValue = (value) => { PedManager.Instance.showPedSpeedometer = value; },
2019-06-23 00:04:01 +00:00
persistType = OptionsWindow.InputPersistType.OnStart,
2020-05-31 17:07:22 +00:00
};
OptionsWindow.FloatInput m_mouseSensitivityXInput = new OptionsWindow.FloatInput() {
description = "Mouse sensitivity x",
minValue = 0.2f,
maxValue = 10f,
2019-06-23 00:13:55 +00:00
isAvailable = () => GameManager.Instance != null,
getValue = () => GameManager.Instance.cursorSensitivity.x,
setValue = (value) => { GameManager.Instance.cursorSensitivity.x = value; },
persistType = OptionsWindow.InputPersistType.OnStart,
2020-05-31 17:07:22 +00:00
};
OptionsWindow.FloatInput m_mouseSensitivityYInput = new OptionsWindow.FloatInput() {
description = "Mouse sensitivity y",
minValue = 0.2f,
maxValue = 10f,
2019-06-23 00:13:55 +00:00
isAvailable = () => GameManager.Instance != null,
getValue = () => GameManager.Instance.cursorSensitivity.y,
setValue = (value) => { GameManager.Instance.cursorSensitivity.y = value; },
persistType = OptionsWindow.InputPersistType.OnStart,
2020-05-31 17:07:22 +00:00
};
void Awake ()
{
2019-06-22 23:43:18 +00:00
OptionsWindow.RegisterInputs ("PLAYER", m_turnSpeedInput, m_enterVehicleRadiusInput,
2020-05-31 17:07:22 +00:00
m_showSpeedometerInput, m_mouseSensitivityXInput, m_mouseSensitivityYInput);
}
}
}