24 lines
635 B
GDScript
24 lines
635 B
GDScript
class_name CutsceneText extends CutsceneItem
|
|
|
|
@export_multiline var interactTexts:Array[String] = []
|
|
var nextTextIndex:int = 0
|
|
|
|
func _enter_tree() -> void:
|
|
pass
|
|
|
|
func _exit_tree() -> void:
|
|
UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing)
|
|
|
|
func start() -> void:
|
|
nextTextIndex = 0
|
|
UI.TEXTBOX.setText(interactTexts[nextTextIndex])
|
|
UI.TEXTBOX.textboxClosing.connect(onTextboxClosing)
|
|
|
|
func onTextboxClosing() -> void:
|
|
nextTextIndex += 1
|
|
if nextTextIndex < interactTexts.size():
|
|
UI.TEXTBOX.setText(interactTexts[nextTextIndex])
|
|
else:
|
|
UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing)
|
|
UI.TEXTBOX.setText("")
|
|
done() |