Implemented spawn points correctly. Added saving & loading (currently only implemented with the spawn_index). You can now set spawn indicies in the DynamicAreaLoader to automatically load when the game is set to that value (on ready). Added configuration warnings to DynamicAreaLoader & PlayerSpawnPoint Added some generic translation (pot) files. Added AudioManager autoload to play, stop, fade audio streams (and set the bus directly). Added SceneFader autoload. Added SaveManager autoload. Added OptionsMenu with currently only volume sliders and a fullscreen toggle button. Added PauseMenu
50 lines
1.0 KiB
GDScript
50 lines
1.0 KiB
GDScript
class_name PauseMenu
|
|
extends Node
|
|
|
|
const ACTION_PAUSE: StringName = &"pause"
|
|
|
|
var can_pause: bool = true
|
|
|
|
@onready var pause_menu: MenuBase = $PauseMenu
|
|
@onready var options_menu: Control = $OptionsMenu
|
|
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event.is_action_pressed(ACTION_PAUSE):
|
|
if options_menu.is_visible_in_tree():
|
|
options_menu.hide()
|
|
pause_menu.show()
|
|
else:
|
|
toggle_pause()
|
|
|
|
|
|
func set_paused(value: bool) -> void:
|
|
if SceneFader.is_fading:
|
|
return
|
|
|
|
get_tree().paused = value
|
|
pause_menu.visible = value
|
|
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if value else Input.MOUSE_MODE_CAPTURED
|
|
|
|
|
|
func toggle_pause() -> void:
|
|
if not can_pause or options_menu.is_visible():
|
|
return
|
|
|
|
set_paused(not get_tree().paused)
|
|
|
|
|
|
func _on_continue_button_pressed() -> void:
|
|
set_paused(false)
|
|
|
|
|
|
func _on_main_menu_button_pressed() -> void:
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
await SceneFader.load_to_path(GameGlobals.MAIN_MENU_PATH, true)
|
|
|
|
|
|
func _on_settings_button_pressed() -> void:
|
|
pause_menu.hide()
|
|
options_menu.show()
|