This repository has been archived on 2023-09-13. You can view files and clone it, but cannot push or open issues or pull requests.
station_obscurum_unity/Assets/Scripts/Game/InGameMenuManager.cs

56 lines
1.5 KiB
C#
Raw Normal View History

using UnityEngine;
using UnityEngine.UI;
2023-06-01 20:25:46 +02:00
namespace Game
{
2023-06-01 20:25:46 +02:00
public class InGameMenuManager : MonoBehaviour
{
2023-06-01 20:25:46 +02:00
[SerializeField] private Button settingsButton;
[SerializeField] private Button returnToMenuButton;
[SerializeField] private Scrollbar sensitivitySlider;
[SerializeField] private Scrollbar volumeSlider;
private InGameManager gameManager;
private Animator menuAnimator;
2023-06-02 06:30:58 +02:00
[SerializeField] private Scriptable.GameSettings settings;
2023-06-01 20:25:46 +02:00
// Start is called before the first frame update
private void Start()
{
menuAnimator = GetComponent<Animator>();
settingsButton.onClick.AddListener(SettingsClicked);
returnToMenuButton.onClick.AddListener(SettingsUnClicked);
2023-06-02 06:30:58 +02:00
2023-06-01 20:25:46 +02:00
gameManager = FindObjectOfType<InGameManager>();
}
// Update is called once per frame
private void Update()
{
}
private void SettingsClicked()
{
menuAnimator.SetBool("SettingsOpen", true);
}
private void SettingsUnClicked()
{
menuAnimator.SetBool("SettingsOpen", false);
}
public void UpdateSensitivity()
{
2023-06-02 06:30:58 +02:00
//player.SetSensitivity(sensitivitySlider.value * 4f);
settings.Sensitivity = sensitivitySlider.value * 4f;
2023-06-01 20:25:46 +02:00
}
public void UpdateVolume()
{
gameManager.SetVolume(volumeSlider.value * 2);
}
}
2023-06-01 17:03:48 +02:00
}