protected virtual void OnFadeFinish(FadeEventArgs e) { if (FadeFinish != null) { FadeFinish.Invoke(this, e); } }
protected virtual void OnFadeStart(FadeEventArgs e) { if (FadeStart != null) { FadeStart.Invoke(this, e); } }
/// Catch finish fading and show logotype in case of fading in. void Instance_FadeFinish(object sender, FadeEventArgs e) { // Show lofo when fade-in finished if (e.Direction == FadeDirection.In) { showLogo = true; } }
private void FadeFinishedInternalHandler(object sender, FadeEventArgs e) { if (e.FadeUp) { visible = true; } else { visible = false; } }
IEnumerator FadeCoroutine(float duration, float targetOpacity, Color color) { Debug.Log("Fading!"); // Announce this is happening. FadeEventArgs fadeArgs = new FadeEventArgs(); fadeArgs.targetOpacity = targetOpacity; // When this fader gets invisible, the screen is being faded in. When it gets // fully-opaque, it's being faded out. if (targetOpacity == 0) { fadeArgs.fadeTarget = FadeStyle.fadeIn; } else if (targetOpacity == 1) { fadeArgs.fadeTarget = FadeStyle.fadeOut; } FadeStarted.Invoke(fadeArgs); // Decide how the fading will be done, and apply the color. float timer = 0; float baseOpacity = alpha; // Do the fading over time. while (timer < duration) { timer += Time.deltaTime; alpha = Mathf.Lerp(baseOpacity, targetOpacity, timer / duration); yield return(null); } alpha = targetOpacity; // In case the duration is 0. // Announce this is done. FadeEnded.Invoke(fadeArgs); coroutine = null; }
/// Catch start fading and hide logotype in case of fading out. void Instance_FadeStart(object sender, FadeEventArgs e) { // Hide logo when fadings starts showLogo = false; }
void TeleportToScene(FadeEventArgs eventArgs) { screenFader.FadeEnded.RemoveListener(TeleportToScene); Destroy(GameController.S.gameObject); SceneManager.LoadScene(sceneName); }
void window_FadeFinished(object sender, FadeEventArgs e) { window.Hide(); NativeMethods.PostMessage(InteropHelper.MainWindow, NativeMethods.CM_SPLASHCLOSE, IntPtr.Zero, IntPtr.Zero); }