TowerGame/scripts/property_label.gd

19 lines
547 B
GDScript

extends Label
@export var path: NodePath
@export var property_name: StringName
@export var format: String
func _process(delta: float) -> void:
var full_path: NodePath = NodePath( path.get_concatenated_names() + ":" + property_name)
#var node = get_node(path)
var arr: Array = get_node_and_resource(full_path)
if arr[0] != null:
var resource: Object = (arr[1] if arr[1] != null else arr[0])
var property
if arr[2] != null:
property = resource.get_indexed(arr[2] as NodePath)
else:
property = resource
text = format % property