Started implementing prologue
This commit is contained in:
@@ -7,6 +7,7 @@ extends Node
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var quest_notification_scene = preload("res://ui/start_quest_notification.tscn")
|
||||
var quest_complete_notification_scene = preload("res://ui/quest_complete_notification.tscn")
|
||||
var narration_notification_scene = preload("res://ui/narration_notification.tscn")
|
||||
var qn: Node
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
@@ -18,7 +19,7 @@ func _ready():
|
||||
var queue = []
|
||||
const cooldown_time: float = 3.0
|
||||
var time_count: float = 0.0
|
||||
enum {N_QUEST, N_QUEST_COMPLETE, N_OTHER}
|
||||
enum {N_QUEST, N_QUEST_COMPLETE, N_NARRATION, N_OTHER}
|
||||
enum {STATE_INIT, STATE_IDLE, STATE_DISPLAY}
|
||||
var state: int = STATE_INIT
|
||||
func quest_notfication(title, desc):
|
||||
@@ -26,6 +27,14 @@ func quest_notfication(title, desc):
|
||||
|
||||
func quest_complete_notfication(title, desc):
|
||||
queue.push_back({"type": N_QUEST_COMPLETE, "title": title, "desc": desc})
|
||||
|
||||
func narration_notification(text):
|
||||
queue.push_back({"type": N_NARRATION, "text": text})
|
||||
|
||||
var _main: Node
|
||||
|
||||
func set_main(main: Node):
|
||||
_main = main
|
||||
|
||||
func _process(delta):
|
||||
match(state):
|
||||
@@ -50,14 +59,19 @@ func _process(delta):
|
||||
match(data.type):
|
||||
N_QUEST:
|
||||
qn = quest_notification_scene.instance()
|
||||
get_node("/root/main").add_child(qn)
|
||||
_main.add_child(qn)
|
||||
qn.display_notification(data.title, data.desc)
|
||||
time_count = 0.0
|
||||
N_QUEST_COMPLETE:
|
||||
qn = quest_complete_notification_scene.instance()
|
||||
get_node("/root/main").add_child(qn)
|
||||
_main.add_child(qn)
|
||||
qn.display_notification(data.title)
|
||||
time_count = 0.0
|
||||
N_NARRATION:
|
||||
qn = narration_notification_scene.instance()
|
||||
_main.add_child(qn)
|
||||
qn.display_notification(data.text)
|
||||
time_count = 0.0
|
||||
state = STATE_IDLE
|
||||
if time_count < 2000.0:
|
||||
time_count += delta
|
||||
|
||||
Reference in New Issue
Block a user