Allow events to grab systems and nodes.

This commit is contained in:
2025-01-07 22:51:18 -06:00
parent 75082e0598
commit c1b3601170
7 changed files with 22 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ class_name Cutscene
const CutsceneEvent = preload("res://scripts/Cutscene/CutsceneEvent.gd");
var queue:Array[CutsceneEvent] = [];
var cutsceneSystem = null;
func setupCutscene() -> void:
print_debug("Cutscene setup has not been overriden");
@@ -25,7 +26,9 @@ func update(delta:float) -> void:
pass
func add(items:Array[CutsceneEvent]) -> void:
queue.append_array(items)
for item in items:
item.cutscene = self
queue.append(item)
func clear() -> void:
if queue.size() == 0:

View File

@@ -1,6 +1,8 @@
class_name CutsceneEvent
const Systems = preload("res://scripts/System/Systems.gd")
var started:bool = false;
var cutscene = null;
func _init() -> void:
pass
@@ -19,3 +21,12 @@ func end() -> void:
func reset() -> void:
started = false
func getCutscene():
return cutscene
func getCutsceneSystem():
return cutscene.cutsceneSystem;
func getSystems() -> Systems:
return getCutsceneSystem().get_node("..") as Systems;

View File

@@ -9,7 +9,7 @@ func _init(
self.text = text;
func start() -> void:
print("He can say ", text);
getSystems().VN.getTextbox().setText(self.text);
func isDone() -> bool:
return false

View File

@@ -4,8 +4,10 @@ const CutsceneWaitEvent = preload("res://scripts/Cutscene/Event/CutsceneWaitEven
const CutsceneConcurrentEvent = preload("res://scripts/Cutscene/Event/CutsceneConcurrentEvent.gd");
const CutsceneIfEvent = preload("res://scripts/Cutscene/Event/CutsceneIfEvent.gd");
const CutsceneWhileEvent = preload("res://scripts/Cutscene/Event/CutsceneWhileEvent.gd");
const TextboxEvent = preload("res://scripts/Cutscene/Event/VisualNovel/TextboxEvent.gd");
func setupCutscene() -> void:
add([
TextboxEvent.new("Cumbria")
]);
pass