Files
fps_project_1/scripts/playlist_loader.gd
2025-03-28 16:48:27 -05:00

33 lines
866 B
GDScript

extends Node
@export var portal_parent : Node3D
@onready var playlist_generator: Control = $"../Playlist Generator"
@onready var current_match = GameGlobals.playlist[GameGlobals.current_match_id]
@onready var current_round = current_match[GameGlobals.current_round_id]["round"]
var portals = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
for i in portal_parent.get_children():
if i is Portal:
portals.append(i)
if current_round.size() == 0:
var next_round = GameGlobals.current_round_id + 1
if next_round <= (GameGlobals.current_match.size() - 1):
GameGlobals.current_round_id = next_round
var id = 0
for i in portals:
if id <= (current_round.size() - 1):
var level_spawn = current_round[id]
i.level_info = level_spawn
else:
i.active = false
id += 1
SaveLoad.save_user_data()