You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
990 B
39 lines
990 B
3 years ago
|
extends Area2D
|
||
|
|
||
|
|
||
|
## The timeline to load when starting the scene
|
||
|
export(String, "TimelineDropdown") var timeline: String
|
||
|
export(bool) var add_canvas = true
|
||
|
export(bool) var reset_saves = true
|
||
|
export(bool) var debug_mode = false
|
||
|
export(bool) var show_immediately = false
|
||
|
|
||
|
# used prevent the dialogue from appearing if the
|
||
|
# player hits space multiple times
|
||
|
var is_dialogue_showing = false
|
||
|
var dialogue = null
|
||
|
|
||
|
func _ready():
|
||
|
if show_immediately:
|
||
|
show_dialogue()
|
||
|
|
||
|
func show_dialogue():
|
||
|
if is_dialogue_showing:
|
||
|
return
|
||
|
dialogue = Dialogic.start(timeline, '', "res://addons/dialogic/Nodes/DialogNode.tscn", debug_mode, add_canvas)
|
||
|
dialogue.connect("timeline_end", self, "after_dialog")
|
||
|
add_child(dialogue)
|
||
|
is_dialogue_showing = true
|
||
|
|
||
|
func hide_dialogue():
|
||
|
if is_dialogue_showing:
|
||
|
remove_child(dialogue)
|
||
|
is_dialogue_showing = false
|
||
|
|
||
|
func after_dialog(s):
|
||
|
is_dialogue_showing = false
|
||
|
|
||
|
func _on_Area2D_area_exited(area):
|
||
|
if area.get_parent().name == "Player":
|
||
|
hide_dialogue()
|