Example #1
0
    private void Start()
    {
        ggm                  = GlobalGameManager.instance;
        levelLength          = ggm.GetLevelLength();
        enemyFrequency       = ggm.GetEnemyFrequency();
        enemyPrefabs         = ggm.GetEnemyPrefabs();
        enemySpawnOrder      = ggm.GetEnemySpawnOrder();
        renderDistance       = ggm.GetRenderDistance();
        seed                 = ggm.GetSeed();
        enemySpawnPositions  = ggm.GetSpecialObjectLocations();
        enemySpecificPrefabs = ggm.GetEnemySpecificPrefabs();

        enemyPointer    = 0;
        playerTransform = GameObject.Find("Player").transform;
        pseudoRandom    = new System.Random(seed.GetHashCode());
        // TODO: Adjust count for obstacle & obstacle difficulty
        int count = 3;

        if (enemyPrefabs.Count > 0)
        {
            PopulatePool(enemyPrefabs, enemyPrefabPool, count);
        }
        PopulateRandomLocations();
        PopulateSpawnOrder();
        if (enemySpecificPrefabs.Count > 0)
        {
            PopulateLocatedObjects(terrainParent, enemySpecificPrefabs, enemySpawnPositions);
        }
    }