17 lines
487 B
GDScript
17 lines
487 B
GDScript
class_name RandomColorLight extends OmniLight3D
|
|
|
|
@export var blinkSpeed: float = 5
|
|
@export var speedVariation: float = 2
|
|
@export var colors: Array[Color] = [
|
|
Color(1, 0, 0),
|
|
Color(0, 1, 0)
|
|
]
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
changeColor()
|
|
|
|
func changeColor() -> void:
|
|
light_color = colors.pick_random()
|
|
get_tree().create_timer(randf_range(blinkSpeed - speedVariation, blinkSpeed + speedVariation)).timeout.connect(changeColor)
|