78 lines
1.8 KiB
GDScript
78 lines
1.8 KiB
GDScript
# TODO: convert to just combat UI, instancing appropriate zone/area
|
|
# BUG: elements not adjusting properly when moving to second monitor
|
|
extends Control
|
|
|
|
|
|
var deltaCount := 0
|
|
var enemyMoveSpeed := 5.0
|
|
# var questComplete := false
|
|
var canContinue := false
|
|
|
|
var worldArea: WorldArea
|
|
var currentAreaQuest: Quest
|
|
|
|
|
|
func _ready() -> void:
|
|
if OS.is_debug_build():
|
|
%DebugMenu.show()
|
|
Engine.time_scale = 10.0
|
|
|
|
SignalBus.quest_generated.connect(_on_quest_generated)
|
|
SignalBus.quest_completed.connect(_on_quest_completed)
|
|
|
|
_create_area()
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
deltaCount += 1
|
|
if canContinue:
|
|
_continue_show()
|
|
|
|
|
|
func _create_area() -> void:
|
|
worldArea = load("res://scenes/world_area.tscn").instantiate()
|
|
add_child(worldArea)
|
|
move_child(worldArea, 0)
|
|
|
|
func _on_button_test_pressed() -> void:
|
|
%DebugMenu/ButtonTest.text = "pass"
|
|
pass
|
|
|
|
|
|
func _on_button_exit_pressed() -> void:
|
|
get_tree().quit()
|
|
|
|
|
|
func _continue_show() -> void:
|
|
%UITop/ContinueButton.modulate.a += 0.05
|
|
|
|
|
|
func _go_next_area() -> void:
|
|
var prevAreaQuest = currentAreaQuest
|
|
# FIXME: breaks at some point?
|
|
SignalBus.area_continue_pressed.emit()
|
|
Globals.debug_print("gna signal emitted")
|
|
%QuestsContainer.remove_child(prevAreaQuest)
|
|
Globals.debug_print("gna quest removed")
|
|
prevAreaQuest.queue_free()
|
|
Globals.debug_print("gna quest queued to free")
|
|
_create_area()
|
|
Globals.debug_print("gna new area created")
|
|
|
|
|
|
func _on_quest_generated(quest) -> void:
|
|
currentAreaQuest = quest
|
|
%QuestsContainer.add_child(currentAreaQuest)
|
|
|
|
|
|
# TODO: move all quest stuff to quest class?
|
|
func _on_quest_completed() -> void:
|
|
if %UITop/AutoCheck.button_pressed:
|
|
_go_next_area()
|
|
else:
|
|
canContinue = true
|
|
|
|
|
|
func _on_continue_button_pressed() -> void:
|
|
_go_next_area()
|