cosmic/scripts/misc/Counter.gd
2023-11-05 21:51:47 +03:00

19 lines
671 B
GDScript

extends Label
@export var counter_id : String
@onready var ship = $"../../.."
@onready var hull = $"../../../Hull"
@onready var shield = $"../../../Shield"
func _process(_delta) -> void:
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})