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

53 lines
1.4 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InGameMenuManager : MonoBehaviour
{
[SerializeField]
private Button settingsButton;
[SerializeField]
private Button returnToMenuButton;
private Animator menuAnimator;
[SerializeField]
private Scrollbar sensitivitySlider;
[SerializeField]
private Scrollbar volumeSlider;
private PlayerComponent player;
private InGameManager gameManager;
// Start is called before the first frame update
void Start()
{
menuAnimator= GetComponent<Animator>();
settingsButton.onClick.AddListener(SettingsClicked);
returnToMenuButton.onClick.AddListener(SettingsUnClicked);
player = GameObject.FindObjectOfType(typeof(PlayerComponent)) as PlayerComponent;
gameManager = GameObject.FindObjectOfType<InGameManager>();
}
void SettingsClicked()
{
menuAnimator.SetBool("SettingsOpen", true);
}
void SettingsUnClicked()
{
menuAnimator.SetBool("SettingsOpen", false);
}
public void UpdateSensitivity()
{
this.player.SetSensitivity(sensitivitySlider.value*4f);
}
public void UpdateVolume()
{
gameManager.SetVolume(volumeSlider.value*2);
}
// Update is called once per frame
void Update()
{
}
}