You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/3rd/D2D_Scripts/Gameplay/OnceObjectInteractor.cs

25 lines
612 B
C#

2 months ago
using D2D.Utilities;
using UnityEngine;
namespace D2D
{
public abstract class OnceObjectInteractor<T> : OnceObjectInteractorBase
where T: Component
{
protected override void CheckInteraction(GameObject other)
{
if (other.Is<T>() && !isObjectInside && CanInteract(other))
{
isObjectInside = true;
OnInteract(other.GetComponent<T>());
}
}
public virtual bool CanInteract(GameObject other)
{
return true;
}
protected abstract void OnInteract(T target);
}
}