Merge branch 'main' of http://212.24.110.183:3000/IPSEITY/Unheimlich_POC
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace OctoCore.Navigation
|
||||
{
|
||||
public class OctoSceneFadeEvent : MonoBehaviour
|
||||
{
|
||||
public UnityEvent _onFadeIn;
|
||||
public UnityEvent _onFadeOut;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (!OctoSceneFade.Instance)
|
||||
{
|
||||
Debug.Log($"[OctoSceneFadeEvent] No OctoSceneFade.Instance found");
|
||||
return;
|
||||
}
|
||||
|
||||
OctoSceneFade.Instance.OnFadeIn += OnFadeIn;
|
||||
OctoSceneFade.Instance.OnFadeOut += OnFadeOut;
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (!OctoSceneFade.Instance)
|
||||
return;
|
||||
|
||||
OctoSceneFade.Instance.OnFadeIn -= OnFadeIn;
|
||||
OctoSceneFade.Instance.OnFadeOut -= OnFadeOut;
|
||||
}
|
||||
|
||||
private void OnFadeIn()
|
||||
{
|
||||
Debug.Log("FadeIn");
|
||||
_onFadeIn?.Invoke();
|
||||
}
|
||||
|
||||
private void OnFadeOut()
|
||||
{
|
||||
Debug.Log("FadeOut");
|
||||
_onFadeOut?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96fe0220e4b4ae44e85d33ec8749979c
|
||||
Reference in New Issue
Block a user