51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Quests
|
|
{
|
|
public enum ObjectiveType
|
|
{
|
|
Kill,
|
|
ReachLocation,
|
|
Talk,
|
|
Collect,
|
|
Interact
|
|
}
|
|
|
|
[Serializable]
|
|
public class QuestObjectiveData
|
|
{
|
|
[Tooltip("Unique ID matching enemy type, NPC ID, Location trigger ID, Item ID, or Interactable ID.")]
|
|
public string targetID;
|
|
|
|
[Tooltip("Description displayed to the player in UI.")]
|
|
public string description;
|
|
|
|
public ObjectiveType objectiveType;
|
|
|
|
[Tooltip("Target quantity required (for Kill/Collect, or repeated interactions). Set to 1 for ReachLocation, Talk, and Interact.")]
|
|
public int requiredAmount = 1;
|
|
}
|
|
|
|
[Serializable]
|
|
public class QuestObjective
|
|
{
|
|
public QuestObjectiveData data;
|
|
public int currentAmount;
|
|
|
|
public bool IsComplete => currentAmount >= data.requiredAmount;
|
|
|
|
public QuestObjective(QuestObjectiveData data)
|
|
{
|
|
this.data = data;
|
|
this.currentAmount = 0;
|
|
}
|
|
|
|
public void AddProgress(int amount)
|
|
{
|
|
if (IsComplete) return;
|
|
currentAmount = Mathf.Min(currentAmount + amount, data.requiredAmount);
|
|
}
|
|
}
|
|
}
|