extends Control

var just_paused = false

func _process(delta: float) -> void:
	if Input.is_action_just_pressed("ui_cancel") and just_paused == false:
		
		unpause()
	just_paused = false


func _on_back_to_menu_button_pressed() -> void:
	get_tree().paused = false
	get_tree().change_scene_to_file("res://UI/MainMenu.tscn")


func _on_restart_button_pressed() -> void:
	get_tree().paused = false
	SceneManager.restart_level()


func _on_resume_button_pressed() -> void:
	unpause()

func unpause() -> void:
	get_tree().paused = false
	visible = false
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
