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

public class DoubleClick : MonoBehaviour
{


    private bool click = true;   //클릭 여부 
    private float clickWaitTime = 0.5f;    //클릭 대기시간  

    private float clickTime;

    public UIManager uiManager;

    public 
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Time.time > clickTime + clickWaitTime)
        {
            click = false;
        }
    }

    public void OnClick()
    {
        if (click)
        {
            OnDoubleClick();
            click = false;
        }
        else
        {
            //Debug.Log("single");
            click = true;
            clickTime = Time.time;
        }
    }

    private void OnDoubleClick()
    {
        uiManager.OnDoubleClicked();
    }
}
