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
68 lines
1.4 KiB
GDScript
68 lines
1.4 KiB
GDScript
extends CanvasLayer
|
|
|
|
|
|
|
|
var fade_in_duration: float = 2.0
|
|
var fade_out_duration: float = 2.0
|
|
var is_fading: bool = false
|
|
var is_loading: bool = false
|
|
|
|
|
|
@onready var interactive_loader: InteractiveLoader = $InteractiveLoader
|
|
@onready var color_rect: ColorRect = $ColorRect
|
|
@onready var loading_hint_animations: AnimationPlayer = $HintMargin/Control/LoadingHint/LoadingHintAnimations
|
|
@onready var loading_hint: TextureRect = $HintMargin/Control/LoadingHint
|
|
|
|
|
|
func _ready() -> void:
|
|
color_rect.hide()
|
|
|
|
|
|
func load_to_path(path: String, unpause_game: bool = false) -> void:
|
|
if is_loading:
|
|
return
|
|
|
|
is_loading = true
|
|
|
|
await fade_in()
|
|
|
|
var scene: PackedScene = await interactive_loader.load_threaded(path)
|
|
|
|
assert(is_instance_valid(scene))
|
|
|
|
get_tree().change_scene_to_packed(scene)
|
|
|
|
if unpause_game:
|
|
get_tree().paused = false
|
|
|
|
fade_out()
|
|
is_loading = false
|
|
|
|
|
|
func fade_in() -> void:
|
|
color_rect.show()
|
|
is_fading = true
|
|
|
|
var tween: Tween = create_tween()
|
|
tween.tween_property(color_rect, ^"color:a", 1.0, fade_in_duration)
|
|
await tween.finished
|
|
|
|
is_fading = false
|
|
|
|
loading_hint_animations.play(&"hover")
|
|
loading_hint.show()
|
|
|
|
|
|
func fade_out() -> void:
|
|
loading_hint_animations.stop()
|
|
loading_hint.hide()
|
|
|
|
is_fading = true
|
|
|
|
var tween: Tween = create_tween()
|
|
tween.tween_property(color_rect, ^"color:a", 0.0, fade_out_duration)
|
|
await tween.finished
|
|
|
|
color_rect.hide()
|
|
is_fading = false
|