Improved world generation, better notifications

This commit is contained in:
Segey Lapin
2019-08-19 04:14:12 +03:00
parent fed6229fb4
commit 005ef6cf6d
6 changed files with 569 additions and 344 deletions

View File

@@ -6,6 +6,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 qn: Node
func _ready():
pass # Replace with function body.
@@ -17,12 +18,15 @@ func _ready():
var queue = []
const cooldown_time: float = 3.0
var time_count: float = 0.0
enum {N_QUEST, N_OTHER}
enum {N_QUEST, N_QUEST_COMPLETE, N_OTHER}
enum {STATE_INIT, STATE_IDLE, STATE_DISPLAY}
var state: int = STATE_INIT
func quest_notfication(title, desc):
queue.push_back({"type": N_QUEST, "title": title, "desc": desc})
func quest_complete_notfication(title, desc):
queue.push_back({"type": N_QUEST_COMPLETE, "title": title, "desc": desc})
func _process(delta):
match(state):
STATE_INIT:
@@ -49,6 +53,11 @@ func _process(delta):
get_node("/root/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)
qn.display_notification(data.title)
time_count = 0.0
state = STATE_IDLE
if time_count < 2000.0:
time_count += delta