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

public class CountEventer : MonoBehaviour
{
    [System.Serializable]
    public class EventInfo
    {
        public int count;
        public UnityEvent eventCall;
        public bool isEnable = true;
        public bool isMany = true;
    }
    public List<EventInfo> eventList = new List<EventInfo>();

    public int callCount;

    public void eventCall()
    {
        ++callCount;
        EventInfo eventInfo = eventList.Find(x => x.count == callCount && x.isEnable);
        if (eventInfo != null)
        {
            eventInfo.isEnable = eventInfo.isMany;
            eventInfo.eventCall?.Invoke();
        }
    }
}
