aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/UI_Control.gd
diff options
context:
space:
mode:
authorLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-08 16:43:32 +0200
committerLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-08 16:43:32 +0200
commit78b6db9f792e18d848383856693cff4ef223a10f (patch)
tree4d0385ae8eb8f450a6b2c40c1886a964134d154d /Scripts/UI_Control.gd
parentbf17c8a97b77cdb783a2751e7ee4a90843a00f06 (diff)
download2023-78b6db9f792e18d848383856693cff4ef223a10f.tar.gz
2023-78b6db9f792e18d848383856693cff4ef223a10f.tar.bz2
2023-78b6db9f792e18d848383856693cff4ef223a10f.zip
checkpoint detection and UI
Diffstat (limited to '')
-rw-r--r--Scripts/UI_Control.gd27
1 files changed, 27 insertions, 0 deletions
diff --git a/Scripts/UI_Control.gd b/Scripts/UI_Control.gd
new file mode 100644
index 0000000..b7ce2a5
--- /dev/null
+++ b/Scripts/UI_Control.gd
@@ -0,0 +1,27 @@
+extends Control
+
+@onready var in_game_ui = $InGameUI
+@onready var post_game_ui = $PostGameUI
+
+@onready var time_label = $InGameUI/CurrentTime
+
+
+func update_timer_label(new_time: float):
+ if(new_time < 0):
+ time_label.text = "Waiting for player to start driving..."
+ return
+ time_label.text = str(new_time).pad_decimals(3)
+
+func switch_to_post_game_UI():
+ in_game_ui.visible = false
+ post_game_ui.visible = true
+ $PostGameUI/FinalTime.text = time_label.text
+
+func switch_to_in_game_UI():
+ in_game_ui.visible = true
+ post_game_ui.visible = false
+
+func _on_start_button_pressed():
+ var root = owner.owner
+ if root and root.has_method("start_driving"):
+ root.start_driving()