/// <summary> /// <para> /// This function is called whenever the app is switching from another state to this. /// Base function must be called at the end of the override. /// </para> /// <example>At the end of the override function, call this: /// <code> /// yield return StartCoroutine(base.AnimateTransitionIn(onTransitionCompleted)); /// </code> /// </example> /// </summary> /// <param name="onTransitionCompleted">Callback to be executed when transition is complete.</param> /// <returns>Animation <see cref="IEnumerator"/>.</returns> protected virtual IEnumerator AnimateTransitionIn(OnTransitionCompleted onTransitionCompleted) { // Set transition flag IsTransitioning = false; Debug.Log($"[{name}] In transition of {name} completed."); yield return(null); // Execute callbacks onTransitionCompleted?.Invoke(); OnTransitionInCompleted?.Invoke(); }
/// <summary> /// <para> /// This function is called whenever the app is switching from this state to another. /// Base function must be called at the end of the override. /// </para> /// <example>At the end of the override function, call this: /// <code> /// yield return StartCoroutine(base.AnimateTransitionOut(onTransitionCompleted)); /// </code> /// </example> /// </summary> /// <param name="onTransitionCompleted">Callback to be executed when transition is complete.</param> /// <returns>Animation <see cref="IEnumerator"/>.</returns> protected virtual IEnumerator AnimateTransitionOut(OnTransitionCompleted onTransitionCompleted) { // Set transition flag IsTransitioning = false; Debug.Log($"[{name}] Out transition of {name} completed."); yield return(null); // Execute callbacks onTransitionCompleted?.Invoke(); OnTransitionOutCompleted?.Invoke(); // Hide itself gameObject.SetActive(false); }
private void ClearUp() { if (Instance == null) { return; } OnTransitionCompleted?.Invoke(); OnTransitionStarted = null; OnTransitionCompleted = null; m_dst = -1; m_transitionCamera.enabled = false; }
private IEnumerator GotoCreateAccount() { float val = 0.0f; while (Mathf.Approximately(val, 1.0f) == false) { val = Mathf.MoveTowards(val, 1.0f, transitionSpeed * Time.deltaTime); for (int i = 0; i < forms.Length; i++) { forms[i].Execute(val); } yield return(null); } OnTransitionCompleted?.Invoke(); RaycastBlocker.Unblock(); }
private IEnumerator DoTransition(mg_jr_Penguin _penguin, OnTransitionCompleted _completionCallback) { Assert.NotNull(_penguin, "Penguin must be provided"); Minigame miniGame = MinigameManager.GetActive(); miniGame.PlaySFX(mg_jr_Sound.UI_TURBO_MODE_START.ClipName()); m_speedLineFX.StartLines(mg_jr_SpeedLineScreenFx.LineStartMode.RANDOM_POSITION); _penguin.StartTransition(); miniGame.PlaySFX(mg_jr_Sound.PLAYER_EXPLODE.ClipName()); yield return(StartCoroutine(FlashWhite(0.1f))); yield return(new WaitForSeconds(2f)); yield return(StartCoroutine(FlashWhite(0.1f))); _penguin.EndTransition(); m_speedLineFX.StopLinesImmediately(); miniGame.PlaySFX(mg_jr_Sound.UI_TURBO_MODE_END.ClipName()); base.gameObject.SetActive(value: false); _completionCallback?.Invoke(); }
/// <inheritdoc /> public async Task DoSceneTransition(IEnumerable <Func <Task> > sceneOperations, IProgressIndicator progressIndicator = null) { if (TransitionInProgress) { throw new Exception("Attempting to do a transition while one is already in progress."); } #region Transition begin TransitionInProgress = true; OnTransitionStarted?.Invoke(); if (progressIndicator == null && sceneTransitionServiceProfile.UseDefaultProgressIndicator) { // If we haven't been given a progress indicator, and we're supposed to use a default // find / create the default progress indicator CreateDefaultProgressIndicator(); progressIndicator = defaultProgressIndicator; } if (UseFadeColor) { await FadeOut(); } if (progressIndicator != null) { await progressIndicator.OpenAsync(); } #endregion #region Task execution // Make sure we're on the main thread foreach (Func <Task> sceneOperation in sceneOperations) { await sceneOperation(); } #endregion #region Transition end // If we used a progress indicator, close it if (progressIndicator != null) { await progressIndicator.CloseAsync(); } if (UseFadeColor) { await FadeIn(); } TransitionInProgress = false; OnTransitionCompleted?.Invoke(); #endregion }
public void CompleteTask() { OnTransitionCompleted?.Invoke(); }