blob: b7ce2a5ad907065755ff5221b13a2a5ba6cecd59 (
plain) (
blame)
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
|
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()
|