void InitGameOver() { FadeToBlack(() => { deathPanel.SetActive(true); var graphics = deathPanel.GetComponentsInChildren <Graphic>(); foreach (var g in graphics) { g.color = g.color.WithA(0); g.raycastTarget = false; } MEC.Timing.RunCoroutine(GraphicsHelper.ChangeGraphicsAlpha(1, deathPanelShowT, EnableRaycastTargets, deathPanelShowCurve, graphics)); deathPanel.GetComponentInChildren <Button>().onClick.AddListener(FadeDeathPanel); void EnableRaycastTargets() { foreach (var g in graphics) { g.raycastTarget = true; } } void FadeDeathPanel() => MEC.Timing.RunCoroutine(GraphicsHelper.ChangeGraphicsAlpha(0, deathPanelHideT, RestartGame, deathPanelHideCurve, graphics)); void RestartGame() { var currentSceneID = SceneManager.GetActiveScene().buildIndex; SceneManager.LoadScene(currentSceneID); } }); }
IEnumerator <float> BeginTutorial() { yield return(MEC.Timing.WaitForSeconds(initialWaitT)); foreach (var step in tutorialSteps) { step.Begin(); bool canContinue = false; MEC.Timing.RunCoroutine(GraphicsHelper.ChangeGraphicsAlpha(1, textFadeInT, () => canContinue = true, null, step.FadingTextList)); while (!step.isStepDone) { yield return(0f); } canContinue = false; MEC.Timing.RunCoroutine(GraphicsHelper.ChangeGraphicsAlpha(0, textFadeOutT, () => canContinue = true, null, step.FadingTextList)); while (!canContinue) { yield return(0f); } } OnTutorialComplete.Invoke(); }
void FadeFromBlack(System.Action Callback = null) => MEC.Timing.RunCoroutine(GraphicsHelper.ChangeGraphicsAlpha(0, fadeOutT, Callback, null, transitionPanel));