53 lines
1.4 KiB
C#
53 lines
1.4 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;
|
|
[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()
|
|
{
|
|
|
|
}
|
|
}
|