32 lines
827 B
GDScript
32 lines
827 B
GDScript
extends Label
|
|
|
|
@export var counter_id : String
|
|
@onready var ship = $"../../.."
|
|
var hull
|
|
var shield
|
|
var rdy = false
|
|
|
|
func _ready():
|
|
get_tree().create_timer(0.05).timeout.connect(is_rdy)
|
|
|
|
func is_rdy():
|
|
rdy = true
|
|
hull = ship.hull
|
|
shield = ship.shield
|
|
|
|
func _process(_delta) -> void:
|
|
if !rdy:
|
|
return
|
|
hull = ship.hull
|
|
shield = ship.shield
|
|
match counter_id:
|
|
"ammo":
|
|
text = str(hull.ammunition)
|
|
"fuel":
|
|
text = "Fuel: {fuel} / {max} units".format({"fuel":hull.fuel, "max":hull.max_fuel})
|
|
"hp":
|
|
text = "Hull Strength: {hp} / {max} units".format({"hp":"%0.2f" % hull.hp, "max":hull.max_hp})
|
|
"money":
|
|
text = "Available Money: {money} units".format({"money":ship.money})
|
|
"shield":
|
|
text = "Shield Capacity: {shield} / {max} units".format({"shield":"%0.2f" % shield.capacity, "max":shield.max_capacity})
|