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
|
extends Control
@export var color_full: Color = Color(1, 0, 0, 1)
@export var color_empty: Color = Color(0, 0, 0, 1)
@export var color_extra_full: Color = Color(1, 1, 0, 1)
@export var color_extra_empty: Color = Color(0, 0, 0, 0)
func set_full():
self.set_color_all(self.color_full)
func set_empty():
self.set_color_all(self.color_empty)
func set_full_parts(parts: int):
self.set_empty()
for i in range(1, parts+1):
self.set_color(i, self.color_full)
func set_extra_full():
self.set_color_all(self.color_extra_full)
func set_extra_full_parts(parts: int):
self.set_color_all(self.color_extra_empty)
for i in range(1, parts+1):
self.set_color(i, self.color_extra_full)
func set_color(index: int, color: Color):
var color_rect: ColorRect = get_node("ColorRect" + str(index))
color_rect.set_color(color)
func set_color_all(color: Color):
for i in range(1, 4+1):
self.set_color(i, color)
|