You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Babushka/scripts/CSharp/Common/Quest/QuestTrigger.cs

31 lines
824 B

using Godot;
using System;
using Babushka.scripts.CSharp.Common.Quest;
public partial class QuestTrigger : Node
{
[Export] public QuestResource? questResource;
[Export] public QuestStatus.Status toStatus;
[Export] private bool makeActive = false;
public void Trigger()
{
GD.Print("trigger");
if (questResource == null)
throw new Exception("QuestResource is not set on QuestTrigger node.");
if (QuestManager.Instance == null)
throw new Exception(
"QuestManager instance is not available. Make sure it is initialized before calling Trigger.");
QuestManager.Instance.ChangeQuestStatus(questResource, toStatus);
if (makeActive)
{
QuestManager.Instance.SetActiveQuest(questResource);
}
}
}