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


namespace SimplifyXR
{

    public class XRClickMapping : EventTrigger
    {

        public float touchDelay = 0.5f;
        public float lastTouch;

        [HideInInspector]
        public Button uGUIButton;
        [HideInInspector]
        public Toggle uGUIToggle;

        // Start is called before the first frame update
        public void Start()
        {
            uGUIButton = this.GetComponent<Button>();
            uGUIToggle = this.GetComponent<Toggle>();
        }

        public void OnClick()
        {
            if(uGUIButton && uGUIButton.interactable) uGUIButton.onClick?.Invoke();
        }

        public void OnValueChanged()
        {
            uGUIToggle.isOn = !uGUIToggle.isOn;
            uGUIToggle.onValueChanged?.Invoke(uGUIToggle.isOn);
        }

    }


}
