44 lines
1.1 KiB
C#
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()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|