FadeOutLoading.cs 613 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using System.Collections;
  3. using TMPro;
  4. /// <summary>
  5. /// This component is responsible of fading out the loading label found in the loading scene
  6. /// </summary>
  7. public class FadeOutLoading : MonoBehaviour
  8. {
  9. TextMeshProUGUI _label;
  10. void OnEnable()
  11. {
  12. _label = GetComponent<TextMeshProUGUI>();
  13. NotificationCenter.AddListener(OnFadeOutUpdate, NotificationType.LoadingFadeOutUpdate);
  14. }
  15. void OnDisable()
  16. {
  17. NotificationCenter.RemoveListener(OnFadeOutUpdate, NotificationType.LoadingFadeOutUpdate);
  18. }
  19. void OnFadeOutUpdate(Notification note)
  20. {
  21. _label.alpha = (float)note.data;
  22. }
  23. }