extends Control


@onready var pause_menu = $"pause_menu/pause_menu"
@onready var level_done_screen = $"level_done_screen/level_done_screen"

var game


			
func initialize(_game):
	self.pause_menu.set_mode_game(_game)
	self.level_done_screen.initialize(_game)
	self.game = _game

	
func _process(_delta):
	#when paused, it calls hide_pause_menu on the menu itself, which unpauses the scene tree
	if Input.is_action_just_pressed("ui_cancel"):
		if pause_menu.is_visible():
			hide_pause_menu()
	

func show_pause_menu():
	self.pause_menu.show_pause_menu()
	
	
func hide_pause_menu():
	if pause_menu.is_visible():
		self.pause_menu.hide_pause_menu()
		
func show_level_done_screen():
	await get_tree().create_timer(0.15).timeout
	#Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
	get_tree().paused = true
	self.level_done_screen.show_level_done_screen()















