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.
25 lines
612 B
C#
25 lines
612 B
C#
3 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);
|
||
|
}
|
||
|
}
|