generated from krampus/template-godot4
27 lines
591 B
GDScript
27 lines
591 B
GDScript
class_name WorldUI extends Control
|
|
## Container & accessor for the world UI.
|
|
|
|
@export var pause_scene := preload("res://src/ui/menus/pause_menu/pause_menu.tscn")
|
|
|
|
@onready var hud_container: Control = %HUDContainer
|
|
|
|
|
|
func _unhandled_key_input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("pause"):
|
|
pause()
|
|
|
|
|
|
func add_player_hud(hud: ShotHUD) -> void:
|
|
hud_container.add_child(hud)
|
|
|
|
|
|
func pause() -> void:
|
|
var menu := pause_scene.instantiate()
|
|
add_child(menu)
|
|
menu.tree_exiting.connect(_unpause)
|
|
get_tree().paused = true
|
|
|
|
|
|
func _unpause() -> void:
|
|
get_tree().paused = false
|