BGJ-2022.1/Assets/Scripts/Interactable/InteractableBase.cs

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();
}
}