IEnumerator SpawnWaves(List <string> wordList) { yield return(new WaitForSeconds(startWait)); while (wordList.Count > 0) { for (int i = 0; i < Mathf.Min(wordList.Count, blockCount); i++) { Vector3 spawnPosition = new Vector3(blockPos_x, blockPos_y, Random.Range(-1.0f, 1.0f) * blockPos_z); Quaternion spawnRotation = Quaternion.identity; blocksController blockController = Instantiate(block, spawnPosition, spawnRotation).GetComponent <blocksController> (); InitialiseBlock(blockController, wordList); yield return(new WaitForSeconds(spawnWait)); } yield return(new WaitForSeconds(waveWait)); } yield return(new WaitForSeconds(endWait)); MoveToNextPlayerScene(); }
private void InitialiseBlock(blocksController blockController, List <string> wordList) { blockController.SetWord(wordList[0]); wordList.RemoveAt(0); }