// Cause damage to character in lava and handle if death of player trigger termination of the game private IEnumerator Damage(Character player) { yield return(new WaitForSeconds(HealthDropSecondsInterval)); while (_characterList.Contains(player)) { player.TakeDamage(HealthDropPerTime); if (GameController.CheckIfGameEnds() && !GameObjectFinder.FindMainCharacter().IsDead) { GameObjectFinder.FindMainCharacter().UpdateProfile(true); } yield return(new WaitForSeconds(HealthDropSecondsInterval)); } }