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 System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@@ -9,12 +10,22 @@ namespace OctoCore.Navigation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class OctoSceneFade : MonoBehaviour
|
public class OctoSceneFade : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public static OctoSceneFade Instance { get; private set; }
|
||||||
|
|
||||||
|
public Action OnFadeIn;
|
||||||
|
public Action OnFadeOut;
|
||||||
|
|
||||||
private Canvas _canvas;
|
private Canvas _canvas;
|
||||||
private Image _fadeImage;
|
private Image _fadeImage;
|
||||||
|
|
||||||
private IEnumerator fadeOutCoroutine;
|
private IEnumerator fadeOutCoroutine;
|
||||||
private IEnumerator fadeInCoroutine;
|
private IEnumerator fadeInCoroutine;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize the fade canvas and image.
|
/// Initialize the fade canvas and image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -54,6 +65,7 @@ namespace OctoCore.Navigation
|
|||||||
StopCoroutine(fadeInCoroutine);
|
StopCoroutine(fadeInCoroutine);
|
||||||
|
|
||||||
StartCoroutine(fadeOutCoroutine = FadeOutCoroutine(duration, color));
|
StartCoroutine(fadeOutCoroutine = FadeOutCoroutine(duration, color));
|
||||||
|
OnFadeOut?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +80,7 @@ namespace OctoCore.Navigation
|
|||||||
StopCoroutine(fadeOutCoroutine);
|
StopCoroutine(fadeOutCoroutine);
|
||||||
|
|
||||||
StartCoroutine(fadeInCoroutine = FadeInCoroutine(duration));
|
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