diff options
Diffstat (limited to 'Stages/Wintermaul/HUD.gd')
-rw-r--r-- | Stages/Wintermaul/HUD.gd | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Stages/Wintermaul/HUD.gd b/Stages/Wintermaul/HUD.gd new file mode 100644 index 0000000..4bff1c5 --- /dev/null +++ b/Stages/Wintermaul/HUD.gd @@ -0,0 +1,53 @@ +class_name HUD +extends CanvasLayer + + +@onready var money: Label = %Money +@onready var income: Label = %Income +@onready var tower: Label = %Tower +@onready var spawn_box: Control = %SpawnBox +@onready var team_top: PanelContainer = %TeamTop +@onready var team_bottom: PanelContainer = %TeamBottom + + +func _ready(): + Client.player.money_changed.connect(func(): + money.text = str(Client.player.money) + ) + Client.player.income_changed.connect(func(): + income.text = str(Client.player.income) + ) + + Client.stage_state_changed.connect(func(state: State): + if state is StateBuild: + $TowerConfigurationsContainer.visible = true + else: + $TowerConfigurationsContainer.visible = false + ) + + +func _input(event: InputEvent): + if event.is_action_pressed("spawn_box_toggle"): + spawn_box.visible = not spawn_box.visible + if event.is_action_pressed("players_list_toggle"): + team_top.visible = not team_top.visible + team_bottom.visible = not team_bottom.visible + + +func _on_build_mode_button_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + if Client.state is StateDefault: + get_tree().current_scene.get_node("StateManager").set_state("StateBuild") + elif Client.state is StateBuild: + get_tree().current_scene.get_node("StateManager").set_state("StateDefault") + + +func _on_spawner_box_button_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + spawn_box.visible = not spawn_box.visible + + +func _on_player_list_button_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + team_top.visible = not team_top.visible + team_bottom.visible = not team_bottom.visible |