summaryrefslogtreecommitdiff
path: root/Assets/Mountools/Extends/LoadingScreen/Presets/LoadingScreenPresetHandle.cs
blob: eba0207eed30c5625d23ace737cf2d965c9600f1 (plain) (blame)
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
using System;
using UnityEngine;

namespace Mountools.LoadingScreen.Presets
{
    [RequireComponent(typeof(LoadingScreen))]
    [RequireComponent(typeof(Animator))]
    public abstract class LoadingScreenPresetHandle : MonoBehaviour
    {
        [HideInInspector] public LoadingScreen loadingScreen;
        [HideInInspector] public Animator animator;

        private void Start()
        {
            loadingScreen = GetComponent<LoadingScreen>();
            animator = GetComponent<Animator>();
            
            loadingScreen.onLoad.AddListener(OnLoad);
            loadingScreen.onLoading.AddListener(OnLoading);
            loadingScreen.onLoaded.AddListener(OnLoaded);
            
            Initialize();
        }

        protected virtual void Initialize() {}
        
        protected abstract void OnLoad(string sceneName);
        protected abstract void OnLoading(float progress);
        protected abstract void OnLoaded();
    }
}