void LooseAllBabies() { while (babies.Count > 0) { BabyController b = babies[0]; babies.Remove(b); b.FreeAttachment(); } }
private void Update() { for (int i = babyFruits.Count - 1; i >= 0; i--) { BabyController baby = babyFruits[i]; if (baby == null) { babyFruits.RemoveAt(i); } else if (Mathf.Abs(player.position.x - baby.transform.position.x) < dropRange) { baby.FreeAttachment(); babyFruits.Remove(baby); } } }