extends CanvasLayer

@export_range(0.1, 10.0) var blinking_interval = 1.0
var blink_time = 0

@onready var label = $Control/Label

signal game_unpause_queued

func _input(event):
	if event.is_action_pressed("pause"):
		get_tree().paused = false
		visible = false
		get_viewport().set_input_as_handled()
		game_unpause_queued.emit()

func _process(delta):
	blink_time += delta
	if blink_time >= blinking_interval:
		blink_time = 0.0
		label.visible = !label.visible

func _on_game_pause_toggled(paused: bool):
	if paused:
		visible = true
		label.visible = true
		blink_time = 0
