void spawnIfCan(Entity e, Vector3 cameraPosition, EnemyFactory factory)
    {
        EnemySpawnerComponent enemySpawner = e.enemySpawner;
        LevelModelComponent levelModel = enemySpawner.model;

        if (levelModel.enemyIndex < levelModel.enemies.Count) {
            EnemySpawnModel enemyModel = levelModel.enemies[levelModel.enemyIndex];
            if (enemyModel.spawnBarrier < cameraPosition.y) {
                levelModel.enemyIndex += 1;
                factory.CreateEnemyByModel(enemyModel);
            }
        }

        if (levelModel.waveIndex < levelModel.waves.Count) {
            WaveSpawnModel waveModel = levelModel.waves[levelModel.waveIndex];
            if (waveModel.spawnBarrier < cameraPosition.y) {
                levelModel.waveIndex += 1;
                pool.CreateEntity()
                    .AddWaveSpawner(waveModel.count, waveModel.type, waveModel.spawnOffset, 0.0f, waveModel.speed, waveModel.health, waveModel.path, waveModel.grid, waveModel.damage);
            }
        }
    }