private IEnumerator SpawnShapeCoroutine(ShapeScriptable _firstShape) { yield return(new WaitForSeconds(startDelayTime)); while (true) { ShapeScriptable shapeToSpawn; if (nextShape != null) { shapeToSpawn = nextShape; nextShape = null; yield return(new WaitForSeconds(0.7f)); } else if (_firstShape != null) { shapeToSpawn = _firstShape; _firstShape = null; } else { int shapeToGuess = spawnedShapes.Count(s => s.IsToGuess()); if (ShapeController.CheckNextShapeToAdd(shapeToGuess)) { yield return(null); continue; } shapeToSpawn = ShapeController.GetRandomShapeMatch(); } SpawnShape(shapeToSpawn); yield return(new WaitForSeconds(DifficultyManager.GetCurrentSpawnRate())); } }