this mech status ui
class_name MechStatusUI extends Node
var mech_id: int = 0
@onready var mech_avatar: TextureRect = %Avatar
@onready var mech_name: Label = %Name
@onready var mech_health: TextureProgressBar = %Health
@onready var mech_shield: TextureProgressBar = %Shield
@onready var number = %Number
func set_mech(_mech_id: int, mech_data: MechData) -> void:
print("Setting mech data", mech_data.avatar)
print("mech_avatar", mech_avatar)
self.mech_id = _mech_id
mech_avatar.texture = mech_data.avatar
number.text = str(1 + mech_id)
mech_health.max_value = mech_data.max_health
mech_health.value = mech_data.max_health
mech_shield.max_value = mech_data.max_shield
mech_shield.value = mech_data.max_shield
func update_health(new_health: int) -> void:
mech_health.value = new_health
func update_shield(new_shield: int) -> void:
mech_shield.value = new_shield
func _on_button_pressed():
get_tree().change_scene_to_file("res://scenes/mech_status_ui/mech_status_expanded_ui.tscn")
```