Started quest system

This commit is contained in:
2025-01-06 23:37:49 -06:00
parent e0e6945cab
commit 93c740f1ff
14 changed files with 89 additions and 33 deletions

View File

@@ -0,0 +1,8 @@
class_name QuestObjective
var name:String
func _init(
name:String
):
self.name = name;

35
scripts/Quest/Quest.gd Normal file
View File

@@ -0,0 +1,35 @@
class_name Quest
const QuestObjective = preload("res://scripts/Quest/Objective/QuestObjective.gd");
enum QuestState {
NOT_STARTED,
ACTIVE,
INACTIVE,
FINISHED
};
var questName:String;
var questState:QuestState = QuestState.NOT_STARTED;
var objectives:Array[QuestObjective] = [];
var currentObjective = -1;
func _init(
questName:String,
objectives:Array[QuestObjective]
) -> void:
self.questName = questName;
self.objectives = objectives;
func getState() -> QuestState:
return questState;
func start():
questState = QuestState.ACTIVE;
currentObjective = 0;
func nextObjective():
currentObjective = currentObjective + 1;
if currentObjective >= objectives.size():
questState = QuestState.FINISHED;
return null;
return objectives[currentObjective];

View File

@@ -0,0 +1,6 @@
class_name QuestExample extends "res://scripts/Quest/Quest.gd"
func _init() -> void:
super("Example Quest", [
QuestObjective.new("Test")
]);