26 lines
614 B
GDScript
26 lines
614 B
GDScript
class_name QuestSystem extends Node
|
|
|
|
enum QuestKey {
|
|
TEST_QUEST
|
|
};
|
|
|
|
var quests:Dictionary[int, Quest]
|
|
|
|
signal questStarted(questKey:QuestKey)
|
|
signal questUpdated(questKey:QuestKey)
|
|
signal questCompleted(questKey:QuestKey)
|
|
|
|
func _ready() -> void:
|
|
_updateQuests()
|
|
|
|
func _updateQuests() -> void:
|
|
quests = {}
|
|
for quest in $Quests.get_children():
|
|
if quest is Quest:
|
|
if quests.has(quest.questKey):
|
|
assert(false, "Quest with key %s already exists" % quest.questKey)
|
|
quests[quest.questKey] = quest
|
|
|
|
for quest in QuestKey:
|
|
assert(quests.has(QuestKey[quest]), "Quest with key %s does not exist" % quest)
|