extends Node

func _ready() -> void:
  EventBus.entity_died.connect(_on_entity_died)

func _on_entity_died(entity: Node) -> void:
  if entity.is_in_group("boss"):
    await get_tree().create_timer(2.0).timeout
    PlayerData.dungeon_cleared = true
    PlayerData.returning_from_dungeon = false
    PlayerData.clear_cache()
    EventBus.dungeon_cleared.emit()
    get_tree().change_scene_to_file("res://scenes/world/world.tscn")
