extends Control

var XTRA_name_timer: Timer = Timer.new();

func quit() -> void:
	get_tree().quit();

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	var XTRA_name_lambda: Callable = func() -> void: ($XTRA/Title as ScramblingText).infinite = false;
	
	XTRA_name_timer.wait_time = 1.0;
	XTRA_name_timer.one_shot = true;
	XTRA_name_timer.connect("timeout", XTRA_name_lambda);
	
	add_child(XTRA_name_timer);
	
	($XTRA/Title as ScramblingText).scrambling = true;
	($XTRA/Title as ScramblingText).infinite = true;
	
	$XTRA.visible = true;
	$GorkaMorka.visible = false;
	$Augi.visible = false;
	$Godot.visible = false;
	
	XTRA_name_timer.start();
	
	$AnimationPlayer.play("xtra_wipe");
	
	
	
	


func _on_animation_player_animation_finished(anim_name: StringName) -> void:
	match anim_name:
		"xtra_wipe":
			var intermission: Timer = Timer.new();
			intermission.wait_time = 0.5;
			intermission.autostart = true;
			intermission.one_shot = true;
			intermission.connect("timeout", func() -> void: $AnimationPlayer.play("gorkamorka_wipe"));
			add_child(intermission);
		
		"gorkamorka_wipe":
			var intermission: Timer = Timer.new();
			intermission.wait_time = 0.5;
			intermission.autostart = true;
			intermission.one_shot = true;
			intermission.connect("timeout", func() -> void: $AnimationPlayer.play("augi_wipe"));
			add_child(intermission);
		
		"augi_wipe":
			var intermission: Timer = Timer.new();
			intermission.wait_time = 0.5;
			intermission.autostart = true;
			intermission.one_shot = true;
			intermission.connect("timeout", func() -> void: $AnimationPlayer.play("technical_wipe"));
			add_child(intermission);
