Started quest system
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class_name TextboxEvent extends "res://scripts/Cutscene/CutsceneEvent.gd"
|
||||
|
||||
var text:string;
|
||||
var text:String;
|
||||
|
||||
func _init(
|
||||
text:string
|
||||
text:String
|
||||
) -> void:
|
||||
super._init();
|
||||
self.text = text;
|
||||
@@ -12,4 +12,4 @@ func start() -> void:
|
||||
print("He can say ", text);
|
||||
|
||||
func isDone() -> bool:
|
||||
return false
|
||||
return false
|
||||
|
@@ -5,14 +5,7 @@ const CutsceneConcurrentEvent = preload("res://scripts/Cutscene/Event/CutsceneCo
|
||||
const CutsceneIfEvent = preload("res://scripts/Cutscene/Event/CutsceneIfEvent.gd");
|
||||
const CutsceneWhileEvent = preload("res://scripts/Cutscene/Event/CutsceneWhileEvent.gd");
|
||||
|
||||
func testIf() -> bool:
|
||||
print("Test if");
|
||||
return true;
|
||||
|
||||
func setupCutscene() -> void:
|
||||
add([
|
||||
CutsceneWhileEvent.new(testIf,[
|
||||
CutscenePrintEvent.new("While")
|
||||
]),
|
||||
]);
|
||||
pass
|
||||
|
@@ -1,4 +1,4 @@
|
||||
class_name Potion extends "res://scripts/Items/Item.gd"
|
||||
class_name Potion extends "res://scripts/Item/Item.gd"
|
||||
|
||||
func getName() -> String:
|
||||
return "Potion"
|
||||
@@ -10,4 +10,4 @@ func isConsumable() -> bool:
|
||||
return true;
|
||||
|
||||
func consume() -> void:
|
||||
print("Consuming Potion");
|
||||
print("Consuming Potion");
|
8
scripts/Quest/Objective/QuestObjective.gd
Normal file
8
scripts/Quest/Objective/QuestObjective.gd
Normal 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
35
scripts/Quest/Quest.gd
Normal 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];
|
6
scripts/Quest/QuestExample.gd
Normal file
6
scripts/Quest/QuestExample.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
class_name QuestExample extends "res://scripts/Quest/Quest.gd"
|
||||
|
||||
func _init() -> void:
|
||||
super("Example Quest", [
|
||||
QuestObjective.new("Test")
|
||||
]);
|
@@ -1,6 +1,6 @@
|
||||
class_name ItemSystem extends Node
|
||||
const Item = preload("res://scripts/Items/Item.gd");
|
||||
const ItemStack = preload("res://scripts/Items/ItemStack.gd");
|
||||
const Item = preload("res://scripts/Item/Item.gd");
|
||||
const ItemStack = preload("res://scripts/Item/ItemStack.gd");
|
||||
|
||||
enum ItemSortType {
|
||||
NAME,
|
||||
@@ -17,7 +17,7 @@ class ItemStackTypeComparator:
|
||||
|
||||
# Constants
|
||||
const ITEM_STACK_SIZE_MAX = 99;
|
||||
var ITEM_POTION = preload("res://scripts/Items/Potion.gd").new();
|
||||
var ITEM_POTION = preload("res://scripts/Item/Potion.gd").new();
|
||||
var inventory:Array[ItemStack] = [];
|
||||
|
||||
# Methods
|
7
scripts/System/QuestSystem.gd
Normal file
7
scripts/System/QuestSystem.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
class_name QuestSystem extends Node
|
||||
|
||||
var QUEST_EXAMPLE = preload("res://scripts/Quest/QuestExample.gd").new();
|
||||
|
||||
var ALL_QUESTS = [
|
||||
QUEST_EXAMPLE
|
||||
]
|
17
scripts/System/Systems.gd
Normal file
17
scripts/System/Systems.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
class_name Systems extends Node
|
||||
const ItemSystem = preload("res://scripts/System/ItemSystem.gd");
|
||||
const CutsceneSystem = preload("res://scripts/System/CutsceneSystem.gd");
|
||||
const QuestSystem = preload("res://scripts/System/QuestSystem.gd");
|
||||
|
||||
var ITEM:ItemSystem;
|
||||
var CUTSCENE:CutsceneSystem;
|
||||
var QUEST:QuestSystem;
|
||||
|
||||
func _ready():
|
||||
ITEM = $Item;
|
||||
CUTSCENE = $Cutscene;
|
||||
QUEST = $Quest;
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
pass
|
@@ -1,14 +0,0 @@
|
||||
class_name Systems extends Node
|
||||
const ItemSystem = preload("res://scripts/Systems/ItemSystem.gd");
|
||||
const CutsceneSystem = preload("res://scripts/Systems/CutsceneSystem.gd")
|
||||
|
||||
var ITEM:ItemSystem;
|
||||
var CUTSCENE:CutsceneSystem;
|
||||
|
||||
func _ready():
|
||||
ITEM = $Item;
|
||||
CUTSCENE = $Cutscene;
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
pass
|
Reference in New Issue
Block a user