30 lines
653 B
C#
30 lines
653 B
C#
using UnityEngine;
|
|
|
|
namespace Interactable
|
|
{
|
|
public abstract class InteractableBase : MonoBehaviour, IInteractable
|
|
{
|
|
protected bool hasBeenInteracted = false;
|
|
public void Interact()
|
|
{
|
|
if (hasBeenInteracted)
|
|
return;
|
|
|
|
OnInteract();
|
|
hasBeenInteracted = true;
|
|
}
|
|
|
|
public void ResetInteraction()
|
|
{
|
|
if (!hasBeenInteracted)
|
|
return;
|
|
|
|
OnResetInteraction();
|
|
hasBeenInteracted = false;
|
|
}
|
|
|
|
protected abstract void OnInteract();
|
|
protected abstract void OnResetInteraction();
|
|
}
|
|
}
|