using UnityEngine;
using UnityEngine.UI;
using OCES.Audio;
using UnityEngine.Audio;

namespace OCES
{
    public class ButtonInvoker : MonoBehaviour
    {
        public GameState targetGameState;
        public bool enableLowpass;
        
        Button m_button;

        void Awake()
        {
            this.m_button = GetComponent<Button>();
            

            this.m_button.onClick.AddListener(ButtonPressed); 
        }

        void OnDestroy()
        {
            this.m_button.onClick.RemoveListener(ButtonPressed);
        }

        private void ButtonPressed()
        {
            AudioSystem.Instance.SetState(this.targetGameState);

            AudioSystem.Instance.SetLowpass(this.enableLowpass);
        }
    }
}
