void Missiles() { if (countWaveDuration > 0) { if (spawnTimer <= 0) { float tempPosY = 0; int tempPosIndex = Random.Range(1, 3); if (aimPlayer == false) { tempPosY = Random.Range(-ABSOLUTE_Y_SPAWN, ABSOLUTE_Y_SPAWN); aimPlayer = true; } else { tempPosY = playerScript.gameObject.transform.position.y; aimPlayer = false; } spawnPosition.x = spawn[tempPosIndex].position.x; spawnPosition.y = tempPosY; GameObject obj_Missile = Missile.GetFromPool(spawnPosition, poolMissile); obstaclesList.Add(obj_Missile); spawnTimer = DifficultyController.instance.missileSpawnRate; } else { spawnTimer -= Time.deltaTime; } } else { WaveManager(); } }