using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DishingSoundScript : MonoBehaviour {



        [FMODUnity.EventRef]
        public string dishCleaning;
        public FMOD.Studio.EventInstance dishcleaner;

    [SerializeField] private bool playOnEnable = false;

    void OnEnable()
    {
        if (playOnEnable)
        {
            PlaySound();
        }
    }

    public void OnDisable()
    {
        dishcleaner.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);

        dishcleaner.release();

        dishcleaner.clearHandle();
    }

    public void PlaySound()
    {

        dishcleaner = FMODUnity.RuntimeManager.CreateInstance(dishCleaning);
        // FMODUnity.RuntimeManager.AttachInstanceToGameObject(musicInstance, GetComponent<Transform>(), GetComponent<Rigidbody>());
        dishcleaner.start();
    }

    public void PauseSound(bool paused)
    {
        dishcleaner.setPaused(paused);
    }

    public void ChangeVolume(float volume)
    {
        dishcleaner.setVolume(volume);
    }
   
}
