forked from harper/spooktober-vnj
resources for choices and branches
This commit is contained in:
@@ -10,9 +10,26 @@ script = ExtResource("2_6pot5")
|
|||||||
dialogue = "this is a test scene for the dialogue system"
|
dialogue = "this is a test scene for the dialogue system"
|
||||||
metadata/_custom_type_script = "uid://dw5jr50hsls5n"
|
metadata/_custom_type_script = "uid://dw5jr50hsls5n"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_iree2"]
|
||||||
|
script = ExtResource("2_6pot5")
|
||||||
|
dialogue = "hehe, well come here and do it hot stuff.."
|
||||||
|
metadata/_custom_type_script = "uid://dw5jr50hsls5n"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_6pot5"]
|
||||||
|
script = ExtResource("4_hiff8")
|
||||||
|
dialogue = Array[ExtResource("2_6pot5")]([SubResource("Resource_iree2")])
|
||||||
|
metadata/_custom_type_script = "uid://cu54e7uh65lq0"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_2y53n"]
|
||||||
|
script = ExtResource("3_iree2")
|
||||||
|
response = "fuck you"
|
||||||
|
scene = SubResource("Resource_6pot5")
|
||||||
|
metadata/_custom_type_script = "uid://d2d5w1vmd71js"
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_2c6wc"]
|
[sub_resource type="Resource" id="Resource_2c6wc"]
|
||||||
script = ExtResource("2_6pot5")
|
script = ExtResource("2_6pot5")
|
||||||
dialogue = "this is the next line the character is saying"
|
dialogue = "this is the next line the character is saying"
|
||||||
|
choices = Array[ExtResource("3_iree2")]([SubResource("Resource_2y53n")])
|
||||||
metadata/_custom_type_script = "uid://dw5jr50hsls5n"
|
metadata/_custom_type_script = "uid://dw5jr50hsls5n"
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_qfeqt"]
|
[sub_resource type="Resource" id="Resource_qfeqt"]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
extends Resource
|
extends Resource
|
||||||
class_name Choice
|
class_name Choice
|
||||||
|
|
||||||
|
@export var response: String
|
||||||
|
@export var scene: DialogueScene
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ class_name Dialogue
|
|||||||
|
|
||||||
@export var character: Character
|
@export var character: Character
|
||||||
@export_multiline() var dialogue: String
|
@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
|
class_name DialogueEncounter
|
||||||
|
|
||||||
var dialogue: DialogueScene
|
var dialogue: DialogueScene
|
||||||
signal step
|
signal step()
|
||||||
|
|
||||||
func _init(path: Resource) -> void:
|
func _init(path: Resource) -> void:
|
||||||
self.dialogue = path
|
self.dialogue = path
|
||||||
@@ -13,6 +13,16 @@ func _input(_event: InputEvent) -> void:
|
|||||||
step.emit()
|
step.emit()
|
||||||
|
|
||||||
func Start():
|
func Start():
|
||||||
for i in self.dialogue.get_scene():
|
await walk_scene(self.dialogue)
|
||||||
print(i.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
|
await step
|
||||||
|
|||||||
Reference in New Issue
Block a user