aboutsummaryrefslogtreecommitdiff
path: root/scripts/gui.gd
blob: 3ad47aaa6f7925f2ba578e3c22e6f5e941c70764 (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
extends Control

var player : Node
var control : Node
var wave : Node

var bottom_bar : Control
var top_bar : Control
var _wave_ongoing : Panel

func _fetch ():
	var root = get_tree().root.get_node("world")
	player = root.get_node("player")
	control = player.get_node("control")
	wave = root.get_node("wave")
	
	if bottom_bar == null: bottom_bar = get_node("bottom_bar")
	if top_bar == null: top_bar = get_node("top_bar")
	if _wave_ongoing == null: _wave_ongoing = $wave_ongoing_indicator

func _ready():
	_fetch()

func refresh ():
	_fetch()
	
	bottom_bar.refresh(control.ineditor)
	top_bar.refresh(control.ineditor)
	
	if wave.ongoing: _wave_ongoing.visible = true
	else: _wave_ongoing.visible = false