regression-test-project/Start.gd

31 lines
952 B
GDScript3
Raw Permalink Normal View History

2020-11-17 20:10:21 +01:00
extends Control
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():
Autoload.can_be_closed = false
2021-03-27 15:53:32 +01:00
for i in Autoload.alone_steps.size() + 1:
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
2020-12-13 19:26:04 +01:00
func _process(_delta):
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
if current_scene == Autoload.alone_steps.size() - 1:
Autoload.can_be_closed = true
2021-03-27 15:53:32 +01:00
for child in get_children():
child.queue_free()
2021-03-27 15:53:32 +01:00
print("Changed scene to " + Autoload.alone_steps[current_scene])
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)