using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;

public class VolumeManager : MonoBehaviour
{
    public AudioMixer mixer;
    public string volumeType;
    private Slider slider;

    private void Start()
    {
        slider = GetComponent<Slider>();
        float sliderValue = PlayerPrefs.GetFloat(volumeType, 1);
        Debug.Log(sliderValue);
        slider.SetValueWithoutNotify(sliderValue);
    }

    public void SetVolumeLevel(float sliderValue) 
    {
        PlayerPrefs.SetFloat(volumeType, sliderValue);
        mixer.SetFloat(volumeType, Mathf.Log10(sliderValue) * 20);
    }


}
