private IEnumerator DieRoutine() { sound.RandomizeSFX(gameOverSound); CameraControl.instance.SetOverlayColor(Color.black, 0.4f, 1.0f); sr.sortingLayerName = "UI"; Time.timeScale = 0f; yield return(new WaitForSecondsRealtime(0.5f)); PlayDeathEffect(transform.position, deathEffect); sound.PlaySingle(heartBreakBuildUpSound); sr.enabled = false; yield return(new WaitForSecondsRealtime(deathEffect.GetSecondsUntilFrame(10))); CameraControl.instance.StartFlashColor(Color.white, 0.4f, 0, 0, 1f); sound.RandomizeSFX(heartBreakSound); yield return(new WaitForSecondsRealtime(1.0f)); transform.parent.gameObject.SetActive(false); Time.timeScale = 1f; CameraControl.instance.DisableOverlay(1.0f); if (OnPlayerDied != null) { OnPlayerDied(); } }
protected virtual IEnumerator ExplodeRoutine() { if (bumpRoutine != null) { StopCoroutine(bumpRoutine); } if (movementRoutine != null) { StopCoroutine(movementRoutine); } rb2d.velocity = Vector2.zero; EffectPooler.PlayEffect(explosionAnim, transform.position, false, 0); SoundManager.RandomizeSFX(deathSound); playerTransform = transform; yield return(new WaitForSeconds(explosionAnim.GetSecondsUntilFrame(2))); gameObject.SetActive(false); }