-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimingRow.gd
111 lines (69 loc) · 1.8 KB
/
TimingRow.gd
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
extends Control
@onready var pilot_name = $"Timing Box/Name"
@onready var lap = $"Timing Box/Lap"
@onready var gate = $"Timing Box/Gate"
@onready var delta = $"Timing Box/Delta"
@onready var progress_bar = $"ProgressBar"
@onready var burst = $"Timing Box/finish_celebration"
@onready var first_burst = $"Timing Box/first_place_celebration"
@onready var lap1_wittness = $"Lap 1 Wittness"
@onready var lap2_wittness = $"Lap 2 Wittness"
var bursted = false
var first_bursted = false
var color_out = "#"
func _ready():
pass
func set_pilot_name(p_name, color):
pilot_name.text = str(p_name)
pilot_name.modulate = color
func set_lap(lap_num):
lap.text = str(lap_num)
func set_gate(gate_num):
if int(gate_num) == 2:
bursted = false
first_bursted = false
gate.text = str(gate_num)
func set_delta(delta_time):
delta.text = str(delta_time)
func set_progress(prog_value, color):
progress_bar.value = prog_value
progress_bar.modulate = color
func set_progress_range(min, max):
progress_bar.min_value = min
progress_bar.max_value = max
func toggle_wittness(is_on):
if is_on:
lap1_wittness.visible = true
lap2_wittness.visible = true
else:
lap1_wittness.visible = false
lap2_wittness.visible = false
func trigger_burst():
if bursted:
return
else:
burst.burst()
bursted = true
func first_place_burst():
if first_bursted:
return
else:
first_burst.burst()
first_bursted = true
func get_pilot_name():
return pilot_name.text
func get_pilot_time():
return delta.text
func get_hex_color():
return color_out
func set_hex_color(hex_color):
color_out = hex_color
func reset():
pilot_name.text = "--"
pilot_name.modulate = Color(Color.WHITE)
lap.text = "--"
gate.text = "--"
delta.text = "--"
progress_bar.value = 0
progress_bar.modulate = Color(Color.WHITE)
bursted = false