summaryrefslogtreecommitdiff
path: root/Game/States/Default/StateDefault.gd
blob: b7b630c1a694ea9c00ab078c728d05c3f22cc0d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class_name StateDefault
extends State


func _state_input(event: InputEvent) -> void:
	if event.is_action_pressed("build_mode_start"):
		set_state("StateBuild")
	
	if event.is_action_pressed("select"):
		if Unit.selected_unit:
			Unit.selected_unit.is_selected = false


func _state_unhandled_input(event: InputEvent) -> void:
	# deselect
	if event.is_action_pressed("select"):
		# if not multi selecting
		if not event.is_double_click() and not Input.is_action_pressed("select_multiple"):
			if Tower.selected_towers:
				for tower in Tower.selected_towers.duplicate():
					tower.is_selected = false