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.
36 lines
1.1 KiB
36 lines
1.1 KiB
using Godot;
|
|
using System;
|
|
using System.Linq;
|
|
using Babushka.scripts.CSharp.Common.Quest;
|
|
|
|
public abstract partial class QuestFulfillmentBase : Node
|
|
{
|
|
[Export] private QuestResource _onActiveQuest;
|
|
[Export] private QuestResource _toNextQuest;
|
|
|
|
[Export] private bool _whenFulfilledSetActiveQuestToDone = true;
|
|
[Export] private bool _whenFulfilledSetNextQuestToActive = true;
|
|
[Export] private bool _whenFulfilledSetNextQuestToFollow = true;
|
|
|
|
protected void Fulfill()
|
|
{
|
|
if (_whenFulfilledSetActiveQuestToDone)
|
|
{
|
|
QuestManager.Instance!.ChangeQuestStatus(_onActiveQuest, QuestStatus.Status.Done);
|
|
}
|
|
if (_whenFulfilledSetNextQuestToActive)
|
|
{
|
|
QuestManager.Instance!.ChangeQuestStatus(_toNextQuest, QuestStatus.Status.Active);
|
|
}
|
|
if (_whenFulfilledSetNextQuestToFollow)
|
|
{
|
|
QuestManager.Instance!.SetFollowQuest(_toNextQuest);
|
|
}
|
|
}
|
|
|
|
protected bool IsQuestActive()
|
|
{
|
|
return QuestManager.Instance!.GetActiveQuests().Any(q => q.Key == _onActiveQuest);
|
|
}
|
|
}
|