feat: OctoSceneFadeEvent
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -9,12 +10,22 @@ namespace OctoCore.Navigation
|
||||
/// </summary>
|
||||
public class OctoSceneFade : MonoBehaviour
|
||||
{
|
||||
public static OctoSceneFade Instance { get; private set; }
|
||||
|
||||
public Action OnFadeIn;
|
||||
public Action OnFadeOut;
|
||||
|
||||
private Canvas _canvas;
|
||||
private Image _fadeImage;
|
||||
|
||||
private IEnumerator fadeOutCoroutine;
|
||||
private IEnumerator fadeInCoroutine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the fade canvas and image.
|
||||
/// </summary>
|
||||
@@ -54,6 +65,7 @@ namespace OctoCore.Navigation
|
||||
StopCoroutine(fadeInCoroutine);
|
||||
|
||||
StartCoroutine(fadeOutCoroutine = FadeOutCoroutine(duration, color));
|
||||
OnFadeOut?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +80,7 @@ namespace OctoCore.Navigation
|
||||
StopCoroutine(fadeOutCoroutine);
|
||||
|
||||
StartCoroutine(fadeInCoroutine = FadeInCoroutine(duration));
|
||||
OnFadeIn?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user