started building out level
Signed-off-by: sdqhome\caleb <caleb@sdqhome.co.uk>
This commit is contained in:
33
Assets/Scripts/Quests/QuestInteractableObjective.cs
Normal file
33
Assets/Scripts/Quests/QuestInteractableObjective.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user