-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading_screen.gd
41 lines (32 loc) · 1.11 KB
/
loading_screen.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
class_name LoadingScreen
extends BaseScreen
signal loading_screen_coverage_completed
var intro_animation: String
var outro_animation: String
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var loading_icon: Control = %LoadingIcon
func setup(
_intro_animation: String = LoadSceneManager.LOAD_ANIMATION_NONE,
_outro_animation: String = LoadSceneManager.LOAD_ANIMATION_NONE
):
self.intro_animation = _intro_animation
self.outro_animation = _outro_animation
func _ready():
loading_icon.set_process(false)
_start_intro_animation()
func _process(_delta):
loading_icon.rotation_degrees += 10
func update_progress_bar(_new_value: float):
pass
func _start_intro_animation():
if intro_animation != LoadSceneManager.LOAD_ANIMATION_NONE:
animation_player.play(intro_animation)
else:
loading_screen_coverage_completed.emit()
func start_outro_animation():
if animation_player.is_playing():
await animation_player.animation_finished
if outro_animation != LoadSceneManager.LOAD_ANIMATION_NONE:
animation_player.play(outro_animation)
await animation_player.animation_finished
queue_free()