private IEnumerator ShowSplashScreen() { _renderer.sprite = null; int numTasks = Count; CoreLogger.LogDebug(_loggerModule, string.Format("starting with {0} sprites and {1} tasks...", segments.Length, numTasks)); if (segments.Length < 1) { while (TasksPending) { yield return(new WaitForEndOfFrame()); } CoreLogger.LogDebug(_loggerModule, string.Format("finished with 0 sprites and {0} tasks", numTasks)); Done(); yield break; } int i = 0; while (TasksPending) { _captureCamera.Capture(); if (_renderer.sprite != null) { _switchTime = Time.time; } yield return(null); SplashScreenSegment segment = segments[_splashIndex]; float waitTime = SetSprite(segment); yield return(new WaitForSeconds(waitTime)); i++; if (cyclic) { _splashIndex = (_splashIndex + 1) % segments.Length; } else { _splashIndex = Mathf.Min(_splashIndex + 1, segments.Length - 1); } } CoreLogger.LogDebug(_loggerModule, string.Format("done showing {0} sprites out of {1}, with {2} tasks", i, segments.Length, numTasks)); Done(); }
/// <summary> /// Sets the next sprite on the splash, handling /// transition effects if defined. /// </summary> /// <returns>Amount of seconds which are the minimum wait time for this sprite.</returns> /// <param name="sprite">Sprite.</param> private float SetSprite(SplashScreenSegment segment) { if (_renderer.sprite == segment.sprite) { return(0f); } CoreLogger.LogDebug(_loggerModule, "setting new sprite"); _renderer.sprite = segment.sprite; if (autoFit) { AutoFit(); } float waitTime = (_processor != null ? Mathf.Max(segment.delay, transition.duration) : segment.delay); return(waitTime); }