extends PanelContainer @onready var morale : Label = $MarginContainer/HBoxContainer/VBoxContainer/Life @onready var life : Label = $MarginContainer/HBoxContainer/VBoxContainer/Morale @onready var options_container : HBoxContainer = $MarginContainer/HBoxContainer/HBoxContainer var ui_option = preload("res://scenes/ui_option.tscn") func _ready(): var player = get_node("../Player") player.connect("curr_tile", Callable(self, "_update_options")) GameData.connect("morale_changed", Callable(self, "_update_morale")) GameData.connect("life_changed", Callable(self, "_update_life")) _update_morale() _update_life() func _update_morale() -> void: morale.text = "Morale:" + str(GameData.get_morale()) func _update_life() -> void: life.text = "Life:" + str(GameData.get_life()) func _update_options(data): for i in options_container.get_children(): i.queue_free() if data != null: for i in data: var option = ui_option.instantiate() option.desc = i["desc"] option.cost = i["cost"] option.is_valid = i["is_valid"] option.sprite_atlas = i["sprite_panel"] options_container.add_child(option)