Files
Darklings-FightingGame/Assets/_Project/Scripts/UIScripts/MenuScripts/OptionsMenu.cs
David Kalatzis 4e8de4b692 UI bug fixes
2023-10-09 12:39:56 +03:00

35 lines
997 B
C#

using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class OptionsMenu : BaseMenu
{
[SerializeField] private InputManager _inputManager = default;
[SerializeField] private AudioMixer _audioMixer = default;
[SerializeField] private Selectable _firstSelectable = default;
public void SetVFX(int value)
{
float parsedValue = ((float)value / 100) + 0.00001f;
_audioMixer.SetFloat("VFXVolume", Mathf.Log10(parsedValue) * 20);
}
public void SetUI(int value)
{
float parsedValue = ((float)value / 100) + 0.00001f;
_audioMixer.SetFloat("UIVolume", Mathf.Log10(parsedValue) * 20);
}
public void SetMusic(int value)
{
float parsedValue = ((float)value / 100) + 0.00001f;
_audioMixer.SetFloat("MusicVolume", Mathf.Log10(parsedValue) * 20);
}
private void OnDisable()
{
PreviousSelectable.Select();
_inputManager.SetPrompts(_inputManager.PreviousPrompts);
}
}