seeding-planets/gui/loading_screen/scripts/loading_screen.gd
Zacharie Guet 9c449b234f developpement d'écran de chargement et d'écran de sélection de niveau
* modification de certains assets
* optimisation de chunks
* ajout d'un SceneManager
* ajout d'un premier dialogue avec Demeter
* changement des jour en charge
* mise en place d'un système de run
* etc...
2026-01-10 13:04:33 +01:00

33 lines
893 B
GDScript

extends CanvasLayer
const LOADING_BAR_UPDATE_TIME := 0.2
var loading_value = 0.
var loading_text = "" :
set(v):
%LoadingText.text = v
loading_text = v
func _ready():
%LoadingInterface.visible = false
func show_loading_screen(animation := true):
%LoadingProgressBar.value = 0.
if animation:
await %LoadingAnimation.fade_in()
else :
%LoadingInterface.visible = true
func hide_loading_screen(animation := true):
if animation and is_node_ready():
if %LoadingAnimation.on_animation:
await %LoadingAnimation.animation_ended
await %LoadingAnimation.fade_out()
else : %LoadingInterface.visible = false
loading_value = 0.
%LoadingProgressBar.value = 0
func _process(_d):
if %LoadingInterface.visible:
%LoadingProgressBar.value = lerp(%LoadingProgressBar.value, loading_value * 100, 0.1)