public void Clear(bool fillEmpty) { if (Row1 == null) { Row1 = new List <GenericWorldItem>(3); Row2 = new List <GenericWorldItem>(3); Row3 = new List <GenericWorldItem>(3); } else { Row1.Clear(); Row2.Clear(); Row3.Clear(); } if (fillEmpty) { for (int i = 0; i < 3; i++) { Row1.Add(null); Row2.Add(null); Row3.Add(null); } } GenericResult = null; //CustomResult = null; }
private void SpawnRows() { for (int row = 0; row < enemyRows; row++) { for (int enemiesInRow = 0; enemiesInRow < enemiesPerRow; enemiesInRow++) { GameObject enemyPrefab = attackerPrefab; if ((row == 2) || (row == 3)) { enemyPrefab = hornetPrefab; } else if (row == 4) { enemyPrefab = bomberPrefab; } Vector3 position = firstEnemyPosition + (enemiesInRow * horizontalGap) + (row * verticalGap); GameObject enemy = Instantiate(enemyPrefab, position, Quaternion.Euler(0, 0, 0)); switch (row) { case 0: Row0.Add(enemy); break; case 1: Row1.Add(enemy); break; case 2: Row2.Add(enemy); break; case 3: Row3.Add(enemy); break; case 4: Row4.Add(enemy); break; default: break; } enemy.SendMessage("ChangeSpeed", initialEnemySpeed); } } }