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

public class ClickEventer : MonoBehaviour
{
    public Event_Base eventChecker;
    public UnityEvent clickEvent;
    public bool isEnable = true;
    public bool isMany = true;
    public bool isLock;

    private void Awake()
    {
        if (eventChecker != null)
        {
            eventChecker.clickEventer = this;
        }
    }
    public void OnClickEvent()
    {
        if (isEnable && isLock == false)
        {
            isEnable = isMany;
            eventChecker?.eventCheck();
            clickEvent?.Invoke();
        }
    }
    public void eventEnableToggle(bool isEnable)
    {
        this.isEnable = isEnable;
        eventChecker.eventEnableToggle(isEnable);
    }
    public void eventEnd()
    {
        this.isMany = false;
        this.isEnable = false;
        this.isLock = true;
    }
}
