IEnumerator GameOver() { NewBallManager.GetInstance().FreezeBalls(); yield return(StartCoroutine(Explode())); NewBallManager.GetInstance().KillAllBalls(); EventManager.TriggerEvent("CleanUp"); yield return(StartCoroutine(CountdownScore())); yield return(StartCoroutine(InterstitalAd())); yield return(StartCoroutine(Implode())); ScoreMaskEffect.GetInstance().Reset(); NewGameManager.GetInstance().ResetGame(); }
IEnumerator GameOver() { float t = 0; while (exploding) { if (t < explodeDuration) { // Debug.Log("growing"); t += Time.deltaTime; transform.localScale = Vector3.one + Vector3.one * targetScale * EZEasings.SmoothStart5(t / explodeDuration); yield return(new WaitForEndOfFrame()); } else { exploding = false; waiting = true; } } // wait at max scale t = 0; while (waiting) { if (t < waitDuration) { // Debug.Log("waiting"); t += Time.deltaTime; yield return(new WaitForEndOfFrame()); } else { waiting = false; imploding = true; } } Vector3 largeScale = transform.localScale; t = 0; while (imploding) { if (t < implodeDuration) { // Debug.Log("imploding"); t += Time.deltaTime; transform.localScale = largeScale - largeScale * EZEasings.SmoothStop5(t / implodeDuration); yield return(new WaitForEndOfFrame()); } else { transform.localScale = Vector3.zero; imploding = false; } } NewGameManager.GetInstance().ResetGame(); Destroy(gameObject); }