2020-11-17 20:10:21 +01:00
|
|
|
extends Control
|
|
|
|
|
2021-05-18 06:56:35 +02:00
|
|
|
var current_scene: int = -1
|
|
|
|
var time_to_switch: int
|
|
|
|
const NUMBER_OF_INSTANCES: int = 1 # Use more than 1 to stress test, 1 should be optimal for casual CI
|
|
|
|
|
|
|
|
var array_with_time_to_change: Array = []
|
2020-11-17 20:10:21 +01:00
|
|
|
|
2021-03-27 15:53:32 +01:00
|
|
|
|
2020-11-17 20:10:21 +01:00
|
|
|
func _ready():
|
2022-01-06 08:36:36 +01:00
|
|
|
Autoload.can_be_closed = false
|
|
|
|
|
2021-03-27 15:53:32 +01:00
|
|
|
for i in Autoload.alone_steps.size() + 1:
|
2022-01-06 08:36:36 +01:00
|
|
|
array_with_time_to_change.append(Autoload.time_object.get_ticks_msec() + i * Autoload.time_for_each_step)
|
2020-11-17 20:10:21 +01:00
|
|
|
|
2021-05-18 06:56:35 +02:00
|
|
|
|
2020-12-13 19:26:04 +01:00
|
|
|
func _process(_delta):
|
2022-01-06 08:36:36 +01:00
|
|
|
if current_scene < Autoload.alone_steps.size() - 1 && Autoload.time_object.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
|
2021-03-27 15:53:32 +01:00
|
|
|
current_scene += 1
|
2022-01-06 08:36:36 +01:00
|
|
|
if current_scene == Autoload.alone_steps.size() - 1:
|
|
|
|
Autoload.can_be_closed = true
|
2021-05-18 06:56:35 +02:00
|
|
|
|
2021-03-27 15:53:32 +01:00
|
|
|
for child in get_children():
|
|
|
|
child.queue_free()
|
2021-05-18 06:56:35 +02:00
|
|
|
|
2021-03-27 15:53:32 +01:00
|
|
|
print("Changed scene to " + Autoload.alone_steps[current_scene])
|
2021-05-18 06:56:35 +02:00
|
|
|
|
2021-03-27 15:53:32 +01:00
|
|
|
for _i in range(NUMBER_OF_INSTANCES):
|
2021-06-22 07:00:48 +02:00
|
|
|
var scene: Node = load(Autoload.alone_steps[current_scene]).instantiate()
|
2021-03-27 15:53:32 +01:00
|
|
|
add_child(scene)
|