//-------------------------------------------// private IEnumerator OnDeath() { _isDead = true; _spriteRenderer.enabled = false; sfxController.Clear(); GameManager.GM.DestroyObject(this, false); int numDeathExplosions = 5; float totalTime = .5f; float interval = totalTime / (float)numDeathExplosions; for (; numDeathExplosions > 0; numDeathExplosions--) { sfxController.SpawnSFXAnimation(GameManager.GM.GetRandomPoint(1, 1), color == PlayerColor.RED ? "RedExplosion" : "BlueExplosion"); yield return(new WaitForSeconds(interval)); } }