Menuing and stuff also sound or smtg but not joever

This commit is contained in:
Kirabsol 2025-01-14 13:11:45 +01:00
parent 33467f6cc4
commit b3a87fb2a6
14 changed files with 6294 additions and 26 deletions

View file

@ -0,0 +1,36 @@
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class SoundSettings : MonoBehaviour
{
[HideInInspector] public AudioSource source;
public AudioClip clip;
public string clipname;
public bool isLoop;
public bool playOnAwake;
[SerializeField] Slider slider;
[SerializeField] AudioMixer audioMixer;
public void SetVolume(float value)
{
if (value < 1)
{
value = 0.01f;
}
RefreshSlider(value);
PlayerPrefs.SetFloat("Saved Maseter Volume", value);
audioMixer.SetFloat("Master Volume", Mathf.Log10(value / 100) * 20f);
}
public void SetVolumeFromSlider()
{
SetVolume(slider.value);
}
public void RefreshSlider(float value)
{
slider.value = value;
}
}