summaryrefslogtreecommitdiff
path: root/Stages/world.gd
blob: b5a4daad46c0a8abec3e875061ec1ced96c1a8c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
extends Stage


func _ready():
	super._ready()
	
	#while true:
		#var scene = preload("res://Units/Unit.tscn")
		#var unit = scene.instantiate()
		#Client.spawn_unit(unit, %Spawn)
		#await get_tree().create_timer(randi_range(1, 2)).timeout
		#await get_tree().create_timer(0.01).timeout
		#break


func _input(event: InputEvent):
	if event.is_action_pressed("ui_accept"):
		for _i in range(0, 1):
			var scene = preload("res://Units/Unit.tscn")
			var unit = scene.instantiate()
			Client.spawn_unit(unit, %Spawn)
	
	if event.is_action_pressed("spawn_box_toggle"):
		hud.spawn_box.visible = not hud.spawn_box.visible


func _on_build_mode_button_gui_input(event: InputEvent) -> void:
	if event.is_action_pressed("builder_tower_select"):
		$StateManager.set_state("StateBuild")


func _on_spawner_box_button_gui_input(event: InputEvent) -> void:
	if event.is_action_pressed("select"):
		hud.spawn_box.visible = not hud.spawn_box.visible