void Show() { gameObject.SetUIAlpha(0); StartCoroutine(M_Math.ExecuteDelayed(m_Item.GetIndex() == 0 ? 0.5f : 4f, () => StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(f); }, 0.5f)) )); }
void OnStartTurn(ITurn turn) { float start = m_GrayScale.GetGray(); if (turn.GetType() == typeof(Unit) && (turn as Unit).OwnerID == 1 && !(turn as Unit).IsIdentified) { StopAllCoroutines(); Noise.enabled = true; StartCoroutine(M_Extensions.YieldT(f => m_GrayScale.SetGray(start + (1 - start) * f), 0.25f)); } else { StopAllCoroutines(); Noise.enabled = false; StartCoroutine(M_Extensions.YieldT(f => m_GrayScale.SetGray(start * (1 - f)), 0.25f)); } }
// The coroutine runs on its own at the same time as Update() and takes an integer indicating which scene to load. IEnumerator LoadNewScene() { Splash.gameObject.SetActive(showsplash); yield return(new WaitForSeconds(0.1f)); if (showsplash) { Loading.gameObject.SetActive(false); showsplash = false; to_load = 1; yield return(StartCoroutine(M_Extensions.YieldT(f => Splash.alpha = f, 0.5f))); yield return(new WaitForSeconds(2f)); yield return(StartCoroutine(M_Extensions.YieldT(f => Splash.alpha = 1 - f, 0.5f))); } else { yield return(new WaitForSeconds(0.5f)); } Loading.gameObject.SetActive(true); Loading.alpha = 0; yield return(StartCoroutine(M_Extensions.YieldT(f => Loading.alpha = f, 0.25f))); // Start an asynchronous operation to load the scene that was passed to the LoadNewScene coroutine. AsyncOperation async = SceneManager.LoadSceneAsync(to_load, LoadSceneMode.Single); // While the asynchronous operation to load the new scene is not yet complete, continue waiting until it's done. while (!async.isDone) { MDebug.Log(async.progress + " " + Time.time); yield return(null); } yield return(StartCoroutine(M_Extensions.YieldT(f => Loading.alpha = 1 - f, 1f))); yield return(new WaitForSeconds(0.5f)); }
void Removed() { StartCoroutine(M_Extensions.YieldT((f) => { gameObject.SetUIAlpha(1 - f); }, 0.5f)); StartCoroutine(M_Math.ExecuteDelayed(0.5f, () => { OnRemoved.AttemptCall(); Destroy(this.gameObject); })); }
IEnumerator Fade() { yield return(new WaitForSeconds(0.3f)); StartCoroutine(M_Extensions.YieldT(SetAlpha, 0.75f)); }