public void Explode(Bubble bubble) { var bubbles = grid.BubblesInRange(bubble, ExplosionRange); foreach (var bb in bubbles) { bb.Movement.Drop(); bb.StartCoroutine(DelayDespawn(bb, 3f)); } grid.Detach(bubble); spawner.Return(bubble); Debug.Log("Exploded!"); }
System.Collections.IEnumerator DelayReturn(Bubble bubble, float time) { grid.Detach(bubble); yield return(new WaitForSeconds(time)); spawner.Return(bubble); }