Completely refractor the project so the code isn't so terrible #7
@ -17,15 +17,21 @@ func the_pausing():
|
|||||||
func the_connecting():
|
func the_connecting():
|
||||||
# iterate through the children and connect up the child_finished method
|
# iterate through the children and connect up the child_finished method
|
||||||
for i in len(get_children()):
|
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
|
# connect the finished signal if it exists and
|
||||||
if get_child(i).get_signal_connection_list("finished_active") == []:
|
# if the failed finished isn't already connected
|
||||||
continue
|
if (get_child(i).has_signal("scene_finished") and
|
||||||
|
get_child(i).get_signal_connection_list("scene_finished") == []):
|
||||||
|
|
||||||
get_child(i).connect("finished_active", self, child_finished())
|
get_child(i).connect("scene_finished", self, child_finished())
|
||||||
|
|
||||||
|
|
||||||
|
# connect the failed signal if it exists and
|
||||||
|
# if the failed signal isn't already connected
|
||||||
|
if (get_child(i).has_signal("scene_failed") and
|
||||||
|
get_child(i).get_signal_connection_list("scene_failed") == []):
|
||||||
|
|
||||||
|
get_child(i).connect("scene_failed", self, child_failed())
|
||||||
|
|
||||||
|
|
||||||
func child_finished():
|
func child_finished():
|
||||||
@ -33,3 +39,10 @@ func child_finished():
|
|||||||
current_active += 1
|
current_active += 1
|
||||||
if current_active >= len(get_children()):
|
if current_active >= len(get_children()):
|
||||||
current_active = 0
|
current_active = 0
|
||||||
|
|
||||||
|
|
||||||
|
func child_failed():
|
||||||
|
# designed to be called from a signal
|
||||||
|
current_active -= 1
|
||||||
|
if current_active < 0:
|
||||||
|
current_active = len(get_children()) - 1
|
||||||
|
Loading…
Reference in New Issue
Block a user