regression-test-project/Start.gd

33 lines
1002 B
GDScript3
Raw Normal View History

2020-11-17 20:10:21 +01:00
extends Control
var current_scene : int = -1
2020-12-13 19:26:04 +01:00
var time_to_switch : int
2020-11-17 20:10:21 +01:00
const NUMBER_OF_INSTANCES : int = 1 # Use more than 1 to stress test, 1 should be optimal for casual CI
2021-03-27 15:53:32 +01:00
var array_with_time_to_change : Array = []
2020-11-17 20:10:21 +01:00
func _ready():
2021-03-27 15:53:32 +01:00
for i in Autoload.alone_steps.size() + 1:
array_with_time_to_change.append(OS.get_ticks_msec() + i * Autoload.time_for_each_step)
2020-11-17 20:10:21 +01:00
print("Starting with scene(s):")
for path in Autoload.all_in_one:
2021-03-27 15:53:32 +01:00
for _i in range(NUMBER_OF_INSTANCES):
var scene : Node = load(path).instance()
add_child(scene)
2020-11-17 20:10:21 +01:00
print(" - " + path)
2020-12-13 19:26:04 +01:00
func _process(_delta):
2021-03-27 15:53:32 +01:00
if current_scene < Autoload.alone_steps.size() - 1 && OS.get_ticks_msec() > array_with_time_to_change[current_scene + 1]:
current_scene += 1
2020-11-17 20:10:21 +01:00
2021-03-27 15:53:32 +01:00
for child in get_children():
child.queue_free()
print("Changed scene to " + Autoload.alone_steps[current_scene])
for _i in range(NUMBER_OF_INSTANCES):
var scene : Node = load(Autoload.alone_steps[current_scene]).instance()
add_child(scene)