/// <summary>
        /// Generates a <see cref="Wave"/> based on the config from <see cref="generationConfig"/>.
        /// </summary>
        /// <param name="number">The number of the <see cref="Wave"/> to generate.</param>
        /// <returns>A <see cref="Wave"/> that was generated based on the <paramref name="number"/>, and the <see cref="generationConfig"/>.</returns>
        public Wave GenerateWave(int number, int pointsAvailable)
        {
            List <EnemySpawnInfo> enemiesToSpawn = new List <EnemySpawnInfo>();

            #region Add introduction enemies to the spawn queue

            EnemySpawnInfo[] enemiesToIntroduce = GetEnemiesToIntroduce(number);
            if (enemiesToIntroduce.Length > 0)
            {
                enemiesToSpawn.AddRange(enemiesToIntroduce);

                for (int i = 0; i < enemiesToIntroduce.Length; i++)
                {
                    pointsAvailable -= enemiesToIntroduce[i].PointsRequiredToSpawn;
                }
            }

            #endregion

            while (pointsAvailable > 0)
            {
                EnemyWaveInfo enemy = GetEnemyBasedOnPoints(pointsAvailable, number);
                if (enemy == null)
                {
                    break;
                }

                #region Check if enemy is already added

                EnemySpawnInfo spawnInfo = null;
                for (int i = 0; i < enemiesToSpawn.Count; i++)
                {
                    if (enemiesToSpawn[i].EnemyPool == enemy.EnemyPool)
                    {
                        spawnInfo = enemiesToSpawn[i];
                        break;
                    }
                }

                #endregion

                // Add to spawn amount or add a new enemy entry based on the previous check.
                if (spawnInfo == null)
                {
                    enemiesToSpawn.Add(new EnemySpawnInfo(enemy.EnemyPool, enemy.PointsRequiredToSpawn));
                }
                else
                {
                    spawnInfo.AddToSpawnAmount();
                }
                pointsAvailable -= enemy.PointsRequiredToSpawn;
            }

            return(new Wave(number, enemiesToSpawn.ToArray()));
        }
        private EnemySpawnInfo[] GetEnemiesToIntroduce(int waveNumber)
        {
            List <EnemySpawnInfo> enemiesToSpawn = new List <EnemySpawnInfo>();

            for (int i = 0; i < enemies.Length; i++)
            {
                if (enemies[i].IntroduceAtWave == waveNumber)
                {
                    EnemySpawnInfo spawnInfo = new EnemySpawnInfo(enemies[i].EnemyPool, enemies[i].PointsRequiredToSpawn);
                    enemiesToSpawn.Add(spawnInfo);

                    for (int j = 1; j < enemies[i].IntroductionSpawnAmount; j++)
                    {
                        spawnInfo.AddToSpawnAmount();
                    }
                }
            }

            return(enemiesToSpawn.ToArray());
        }