extends Node

@onready var grid: Grid = get_parent()

func _ready() -> void:
	GameplaySignalBus.spawn_unit.connect(on_unit_spawned)

func on_unit_spawned(unit: Unit):
	if grid.try_set_unit(unit.global_position,unit):
		GameplaySignalBus.unit_spawn_confirmed.emit()
	else:
		GameplaySignalBus.unit_spawn_cancelled.emit()
