extends Node
## Глобальный менеджер игры (Autoload).

var current_level: int = 1
var levels_completed: Array[int] = []
var total_levels: int = 5


func complete_level(level: int) -> void:
	if level not in levels_completed:
		levels_completed.append(level)
	if level < total_levels:
		current_level = level + 1


func is_level_completed(level: int) -> bool:
	return level in levels_completed


func go_to_level(level: int) -> void:
	current_level = level
	var path := "res://scenes/levels/level_%d.tscn" % level
	get_tree().change_scene_to_file(path)


func go_to_menu() -> void:
	get_tree().change_scene_to_file("res://scenes/main_menu.tscn")


func go_to_level_select() -> void:
	get_tree().change_scene_to_file("res://scenes/level_select.tscn")
