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

44 lines
1.1 KiB
C#

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;
private PlayerComponent player;
// 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;
}
void SettingsClicked()
{
menuAnimator.SetBool("SettingsOpen", true);
}
void SettingsUnClicked()
{
menuAnimator.SetBool("SettingsOpen", false);
}
public void UpdateSensitivity()
{
this.player.SetSensitivity(sensitivitySlider.value);
}
// Update is called once per frame
void Update()
{
}
}