Ejemplo n.º 1
0
    private void Spawn()
    {
        // take spawn point from stack
        // if the stack is empty, then reshuffle
        if (spawnStack.Count == 0)
        {
            // reshuffle
            spawnStack = ListUtility.CreateShuffledStack(spawnPoints);
        }

        var spawnPoint = spawnStack.Pop();

        var enemy = Instantiate(enemyPrefab, enemyParent.transform);

        // set the position
        enemy.transform.position = spawnPoint.transform.position;
    }
Ejemplo n.º 2
0
 private void SpawnEnemiesRepeating()
 {
     // shuffle my stack first (from Utilities namespace)
     spawnStack = ListUtility.CreateShuffledStack(spawnPoints);
     InvokeRepeating(ParentUtils.SPAWN_METHOD, spawnDelay, spawnInterval);
 }