Example #1
0
 public static void RealtimeDelayCall(this MonoBehaviour component, Callback function,
                                      float seconds = 1)
 {
     component.StartCoroutine(
         CoroutineUtility.RunThenCallback(
             CoroutineUtility.WaitForRealtimeSeconds(seconds), function));
 }
    public static void OneShotFadeTransition(float totalDuration,
                                             float blackScreenPauseDuration = 0.0f)
    {
        float            fadeDuration      = totalDuration * 0.5f;
        ScreenTransition screenTransition  = new ScreenTransition(fadeDuration);
        IEnumerator      coroutineSequence = CoroutineUtility.RunSequentially(
            screenTransition.FadeOut(),
            CoroutineUtility.WaitForRealtimeSeconds(blackScreenPauseDuration),
            screenTransition.FadeIn()
            );

        TransitionUtility.instance.StartCoroutine(
            CoroutineUtility.RunThenCallback(
                coroutineSequence,
                () => Destroy(screenTransition.panel.panel)));
    }