2023-05-12 02:14:49 +02:00
|
|
|
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;
|
2023-05-18 06:08:40 +02:00
|
|
|
[SerializeField]
|
|
|
|
private Scrollbar volumeSlider;
|
2023-05-12 02:14:49 +02:00
|
|
|
private PlayerComponent player;
|
2023-05-18 06:08:40 +02:00
|
|
|
private InGameManager gameManager;
|
2023-05-12 02:14:49 +02:00
|
|
|
|
|
|
|
// 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;
|
2023-05-18 06:08:40 +02:00
|
|
|
gameManager = GameObject.FindObjectOfType<InGameManager>();
|
2023-05-12 02:14:49 +02:00
|
|
|
}
|
|
|
|
void SettingsClicked()
|
|
|
|
{
|
|
|
|
menuAnimator.SetBool("SettingsOpen", true);
|
|
|
|
}
|
|
|
|
void SettingsUnClicked()
|
|
|
|
{
|
2023-05-17 06:15:44 +02:00
|
|
|
|
2023-05-12 02:14:49 +02:00
|
|
|
menuAnimator.SetBool("SettingsOpen", false);
|
|
|
|
}
|
|
|
|
public void UpdateSensitivity()
|
|
|
|
{
|
2023-05-18 06:08:40 +02:00
|
|
|
this.player.SetSensitivity(sensitivitySlider.value*4f);
|
|
|
|
}
|
|
|
|
public void UpdateVolume()
|
|
|
|
{
|
|
|
|
gameManager.SetVolume(volumeSlider.value*2);
|
2023-05-12 02:14:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|