class_name PauseSingleton extends Node

func _ready() -> void:
  process_mode = Node.PROCESS_MODE_ALWAYS

func _unhandled_input(event:InputEvent) -> void:
  if !event.is_action_pressed("pause"):
    return
  var menu:PauseMenu = UI.PAUSE_MENU
  if menu == null:
    return
  if menu.isOpen():
    menu.close()
  else:
    menu.open()
  get_viewport().set_input_as_handled()
