things
This commit is contained in:
parent
a17810ffeb
commit
4e91f448c9
826 changed files with 66 additions and 8 deletions
35
Assets/Scripts/SoundSettings.cs
Normal file
35
Assets/Scripts/SoundSettings.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SoundSettings : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] Slider slider;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SoundManager.Instance.PlayMusic("wait");
|
||||
}
|
||||
|
||||
public void SetVolume(float value)
|
||||
{
|
||||
if (value < 1)
|
||||
{
|
||||
value = 0.01f;
|
||||
}
|
||||
RefreshSlider(value);
|
||||
SoundManager.Instance.MusicSource.volume = value;
|
||||
}
|
||||
|
||||
public void SetVolumeFromSlider()
|
||||
{
|
||||
SetVolume(slider.value);
|
||||
}
|
||||
|
||||
public void RefreshSlider(float value)
|
||||
{
|
||||
slider.value = value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue