using UnityEngine;
using UnityEngine.Events;

public class Interactable : MonoBehaviour
{
    public UnityEvent onInteractEvent;
    public bool active;

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            onInteractEvent.Invoke();
        }
    }

    private void OnTriggerStay2D(Collider2D collision)
    {
        if(collision.tag == "Player" )
        {
            active = true;              
        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        if(collision.tag == "Player")
        {
            active = false;
        }        
    }
}
