IEnumerator GenerateBubblesForSingleGame() { if (_levelTimer == 0) { NextLevel(); yield return(new WaitForSeconds(0.1f)); StartCoroutine(GenerateBubblesForSingleGame()); } else { BubbleController newBubble = bubblesGenerator.GenerateNewBubble(smallBubbleSpeed, bigBubbleSpeed); NetController.SendMessage(NetMessageCode.NewBubble, newBubble.GenerateNewBubbleProxy()); bubblesDict.Add(newBubble.id, newBubble); float nextBubbleTimeDelay = UnityEngine.Random.Range(bubbleGenerationDelay - ConfigDictionary.Config.bubbleGenerationDelayRandom, bubbleGenerationDelay + ConfigDictionary.Config.bubbleGenerationDelayRandom); yield return(new WaitForSeconds(nextBubbleTimeDelay)); StartCoroutine(GenerateBubblesForSingleGame()); } }