Ejemplo n.º 1
0
    void SpawnEnemy()
    {
        GameObject    enemy       = GameObject.Instantiate(enemyPrefab, spawnLocation, new Quaternion(0, 0, 0, 0));
        StandardEnemy enemyScript = enemy.GetComponent <StandardEnemy>();

        enemyScript.SetLevel(1, enemy.GetComponent <StandardEnemy>().GetNavMeshAgent(), true);
        enemy.name = "IntroSceneEnemy";
        enemies.Add(enemy);
        StartCoroutine(enemyScript.TurnOnNavMeshAgent());
        DebugLog("Enemy Spawned", consoleLogs);
        enemySpawned = true;
        StartCoroutine(Story());
    }
Ejemplo n.º 2
0
 IEnumerator SpawnEnemies()
 {
     for (int i = 0; i < enemiesCount; i++)
     {
         System.Random rnd   = new System.Random();
         int           level = 1;
         if ((waveNr / 2 * enemyLevelMultiply) > 1)
         {
             level = rnd.Next(1, (int)(waveNr / 2 * enemyLevelMultiply));
         }
         //Debug.Log(spawnLocations[rnd.Next(0, spawnLocations.Count - 1)]);
         GameObject    enemy       = GameObject.Instantiate(enemyPrefab, spawnLocations[rnd.Next(0, spawnLocations.Count - 1)], new Quaternion(0, 0, 0, 0));
         StandardEnemy enemyScript = enemy.GetComponent <StandardEnemy>();
         enemyScript.SetLevel(level, enemy.GetComponent <StandardEnemy>().GetNavMeshAgent(), false);
         enemy.name = "Enemy[" + i + "]";
         enemies.Add(enemy);
         StartCoroutine(enemyScript.TurnOnNavMeshAgent());
         yield return(new WaitForSeconds(1f));
     }
     waveInitialized = true;
 }