summaryrefslogtreecommitdiff
path: root/UI/spawn_button.gd
blob: bcf9da0a89c5c6534799adb5eb5b844321932d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extends TextureButton


@export var unit_resource: UnitResource


func _ready():
	tooltip_text = "Cost: " + str(unit_resource.cost) + "\n" + "Income: " + str(unit_resource.income)


func _on_pressed() -> void:
	var unit = preload("res://Units/Unit.tscn").instantiate() as Unit
	
	unit.unit_resource = unit_resource
	
	Client.spawn_unit(unit, Client.current_stage.get_spawn(), Client.current_stage.get_overwrite_target())