resources for choices and branches
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
extends Resource
|
||||
class_name Choice
|
||||
|
||||
@export var response: String
|
||||
@export var scene: DialogueScene
|
||||
|
||||
@@ -3,4 +3,4 @@ class_name Dialogue
|
||||
|
||||
@export var character: Character
|
||||
@export_multiline() var dialogue: String
|
||||
@export var choice: Dictionary[Choice, Dialogue]
|
||||
@export var choices: Array[Choice]
|
||||
|
||||
@@ -2,7 +2,7 @@ extends Node
|
||||
class_name DialogueEncounter
|
||||
|
||||
var dialogue: DialogueScene
|
||||
signal step
|
||||
signal step()
|
||||
|
||||
func _init(path: Resource) -> void:
|
||||
self.dialogue = path
|
||||
@@ -13,6 +13,16 @@ func _input(_event: InputEvent) -> void:
|
||||
step.emit()
|
||||
|
||||
func Start():
|
||||
for i in self.dialogue.get_scene():
|
||||
print(i.dialogue)
|
||||
await walk_scene(self.dialogue)
|
||||
|
||||
func walk_scene(next_scene: DialogueScene):
|
||||
print("walking scene")
|
||||
for scene in next_scene.get_scene():
|
||||
print(scene.dialogue)
|
||||
if scene.choices.size() > 0:
|
||||
for choice in scene.choices:
|
||||
print(choice.response)
|
||||
if Input.is_key_pressed(KEY_1):
|
||||
await walk_scene(scene.choices[0].scene)
|
||||
step.emit()
|
||||
await step
|
||||
|
||||
Reference in New Issue
Block a user