extends TextureButton @export var texture: Texture2D @export var sprite_sheet: SpriteFrames @export var cost := 5 func _ready(): tooltip_text = "Cost: " + str(cost) func _on_pressed() -> void: var unit = preload("res://Units/Unit.tscn").instantiate() as Unit if texture: unit.get_node("Sprite2D").texture = texture unit.get_node("Sprite2D").scale = Vector2(32,32) / texture.get_size() if sprite_sheet: unit.get_node("AnimatedSprite2D").sprite_frames = sprite_sheet Client.spawn_unit(unit, Client.current_stage.get_spawn(), Client.current_stage.get_overwrite_target())