Completely refractor the project so the code isn't so terrible #7

Merged
CactiChameleon9 merged 39 commits from card-rework into main 2022-08-24 09:51:59 +01:00
2 changed files with 41 additions and 0 deletions
Showing only changes of commit d863e991bb - Show all commits

View File

@ -0,0 +1,35 @@
extends Node
var current_active : int = 0
func _process(_delta):
the_connecting()
the_pausing()
func the_pausing():
# iterate through the children, allowing only the current active node to run
for i in len(get_children()):
get_child(i).pause_mode = 0 if i == current_active else 1
func the_connecting():
# iterate through the children and connect up the child_finished method
for i in len(get_children()):
# don't connect the signal if it doesn't exist
if not get_child(i).has_signal("finished_active"):
continue
# don't connect the signal if already connected
if get_child(i).get_signal_connection_list("finished_active") == []:
continue
get_child(i).connect("finished_active", self, child_finished())
func child_finished():
# designed to be called from a signal
current_active += 1
if current_active >= len(get_children()):
current_active = 0

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Management/ActiveController.gd" type="Script" id=1]
[node name="ActiveController" type="Node"]
script = ExtResource( 1 )