regression-test-project/Start.gd

25 lines
801 B
GDScript3
Raw Normal View History

2020-11-17 19:21:50 +01:00
extends Control
var current_scene : int = -1
2020-12-04 13:50:02 +01:00
var time_to_switch : int
2020-11-17 19:21:50 +01:00
const NUMBER_OF_INSTANCES : int = 1 # Use more than 1 to stress test, 1 should be optimal for casual CI
2021-01-13 16:58:14 +01:00
var array_with_time_to_change : Array = []
2020-11-17 19:21:50 +01:00
func _ready():
2021-01-13 16:58:14 +01:00
for i in Autoload.alone_steps.size() + 1:
2021-02-13 13:44:18 +01:00
array_with_time_to_change.append(OS.get_ticks_msec() + i * Autoload.time_for_each_step)
2020-11-17 19:21:50 +01:00
2020-12-04 13:50:02 +01:00
func _process(_delta):
2021-01-13 16:58:14 +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 19:21:50 +01:00
2021-01-13 16:58:14 +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)