浏览代码

Fixed instigator forwrading in FullScreenFade

/main
Thomas ICHÉ 6 年前
当前提交
70c03044
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 2
      Runtime/LevelScripting/Actions/FullScreenFadeAction.cs
  2. 12
      Runtime/Managers/Implementations/FullScreenFadeManager.cs

2
Runtime/LevelScripting/Actions/FullScreenFadeAction.cs


public override void Execute(GameObject instigator = null)
{
Manager.Get<FullScreenFadeManager>().Fade(Duration, Fading, OnComplete);
Manager.Get<FullScreenFadeManager>().Fade(Duration, Fading, OnComplete, instigator);
}
}

12
Runtime/Managers/Implementations/FullScreenFadeManager.cs


private Coroutine m_Coroutine;
public void Fade(float duration, FadeMode mode, Callable[] OnComplete)
public void Fade(float duration, FadeMode mode, Callable[] OnComplete, GameObject instigator = null)
{
if (m_Coroutine != null)
{

}
FullScreenFadePlane.gameObject.SetActive(color.a == 1.0f);
FullScreenFadePlane.color = color;
Callable.Call(OnComplete);
Callable.Call(OnComplete, instigator);
}
else
{

m_Coroutine = StartCoroutine(FadeCoroutine(duration, 1.0f, 1.0f, OnComplete));
m_Coroutine = StartCoroutine(FadeCoroutine(duration, 1.0f, 1.0f, OnComplete, instigator));
m_Coroutine = StartCoroutine(FadeCoroutine(duration, 0.0f, -1.0f, OnComplete));
m_Coroutine = StartCoroutine(FadeCoroutine(duration, 0.0f, -1.0f, OnComplete, instigator));
break;
default: throw new NotImplementedException();
}

IEnumerator FadeCoroutine(float duration, float target, float sign, Callable[] OnComplete)
IEnumerator FadeCoroutine(float duration, float target, float sign, Callable[] OnComplete, GameObject instigator)
{
FullScreenFadePlane.gameObject.SetActive(true);
Color c = FullScreenFadePlane.color;

Color finalColor = FullScreenFadePlane.color;
finalColor.a = target;
FullScreenFadePlane.color = finalColor;
Callable.Call(OnComplete);
Callable.Call(OnComplete, instigator);
FullScreenFadePlane.gameObject.SetActive(target != 0.0f);
yield return new WaitForEndOfFrame();

正在加载...
取消
保存