wasteland till prisoner
This commit is contained in:
40
Assets/Scripts/Triggers/QuestRequirement.cs
Normal file
40
Assets/Scripts/Triggers/QuestRequirement.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
using Sirenix.OdinInspector; // Required for [ShowIf]
|
||||
using PixelCrushers.QuestMachine; // Required for Quest Machine types
|
||||
|
||||
namespace Beyond
|
||||
{
|
||||
[System.Serializable]
|
||||
public class QuestRequirement
|
||||
{
|
||||
[Tooltip("The ID of the quest to check. (Case-sensitive, copy from Quest Editor)")]
|
||||
public string questID;
|
||||
|
||||
[Tooltip("If checking a specific node, enter ID here. Leave empty to check the overall Quest State.")]
|
||||
public string questNodeID;
|
||||
|
||||
[ShowIf("@string.IsNullOrEmpty(this.questNodeID)")]
|
||||
[Tooltip("The state the Main Quest must be in.")]
|
||||
public QuestState requiredQuestState = QuestState.Active;
|
||||
|
||||
[ShowIf("@!string.IsNullOrEmpty(this.questNodeID)")]
|
||||
[Tooltip("The state the specific Node must be in.")]
|
||||
public QuestNodeState requiredNodeState = QuestNodeState.Active;
|
||||
|
||||
public bool IsMet()
|
||||
{
|
||||
if (string.IsNullOrEmpty(questID)) return true;
|
||||
|
||||
if (string.IsNullOrEmpty(questNodeID))
|
||||
{
|
||||
// CHECK QUEST STATE
|
||||
return QuestMachine.GetQuestState(questID) == requiredQuestState;
|
||||
}
|
||||
else
|
||||
{
|
||||
// CHECK NODE STATE
|
||||
return QuestMachine.GetQuestNodeState(questID, questNodeID) == requiredNodeState;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user