Files
TopDown/Assets/Scripts/Quests/QuestInteractableObjective.cs

34 lines
1.0 KiB
C#
Raw Permalink Normal View History

using UnityEngine;
using Quests;
namespace Quests
{
public class QuestInteractableObjective : Interactable
{
[Header("Quest Objective Settings")]
[Tooltip("The Target ID matching the Quest Objective's targetID for ObjectiveType.Interact")]
[SerializeField] private string interactableObjectiveID;
[Tooltip("If true, reports to QuestManager upon interaction.")]
[SerializeField] private bool reportOnInteract = true;
[Tooltip("If true, disables interaction after triggering once.")]
[SerializeField] private bool singleUse = false;
private bool hasBeenInteracted = false;
public override void Interact(GameObject interactor)
{
if (hasBeenInteracted && singleUse) return;
base.Interact(interactor);
if (reportOnInteract && QuestManager.Instance != null)
{
QuestManager.Instance.ReportInteract(interactableObjectiveID);
hasBeenInteracted = true;
}
}
}
}