23 lines
637 B
GDScript3
23 lines
637 B
GDScript3
|
extends Node3D
|
||
|
|
||
|
var rings_count = 72727
|
||
|
var finished_rings_count = 0
|
||
|
var rings: Array[Node] = []
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready() -> void:
|
||
|
var rings_node = get_node("Rings")
|
||
|
assert(is_instance_valid(rings_node), self.name + " has no rings!")
|
||
|
rings = rings_node.get_children()
|
||
|
rings_count = len(rings)
|
||
|
|
||
|
for ring in rings:
|
||
|
ring.connect("collect_signal", do_we_end_yet)
|
||
|
|
||
|
func do_we_end_yet():
|
||
|
finished_rings_count += 1
|
||
|
if finished_rings_count >= rings_count:
|
||
|
var game = get_parent().get_parent()
|
||
|
if is_instance_valid(game) and game.has_method("stop_level"):
|
||
|
game.stop_level()
|