Files
HauntedBloodlines/Assets/Scripts/Events/EventTriggerRaycast.cs
2025-05-29 22:31:40 +03:00

35 lines
709 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace InfallibleCode
{
public class EventTriggerRaycast : MonoBehaviour, IInteractable
{
public UnityEvent Action;
public bool doEventOnce;
private bool canInvokeEvent = true;
public void Invoke()
{
if (canInvokeEvent)
{
Action.Invoke();
if (doEventOnce)
{
canInvokeEvent = false;
//gameObject.SetActive(false);
}
}
}
public void Interact()
{
Invoke();
}
}
}