extends CanvasLayer

@onready var label: Label = $Center/VBox/Label
@onready var button: Button = $Center/VBox/Button

func _ready() -> void:
  visible = false
  button.pressed.connect(_on_button)

func show_overlay(wave: int) -> void:
  label.text = "GAME OVER — Welle %d erreicht" % wave
  visible = true

func _on_button() -> void:
  GameState.reset()
  PlayerData.reset_run()
  EnemyData.entities.clear()
  BossData.entities.clear()
  PortalData.entities.clear()
  TavernData.entities.clear()
  get_tree().change_scene_to_file("res://scenes/menu/main_menu.tscn")
