Exemple #1
0
    private void SpawnEnemy(int a)
    {
        if (PRSpawnEnemy == null)
        {
            PRSpawnEnemy = new GameObject("PR Enemy Spawned");
            PRSpawnEnemy.transform.parent = transform;
        }
        if (Data.Waves == null)
        {
            Clear();
            Debug.Log("Waves null?");
            return;
        }
        Wave         v         = Data.Waves.GetWave(a);
        List <Enemy> listEnemy = DataMap.GetListEnemyPrefab(v.TotalLevel, v.MinLevel, v.MaxLevel);

        if (listEnemy == null || listEnemy.Count == 0)
        {
            Debug.Log("Không có danh sánh Enemy trong đợt " + a + ", tiếp tục đợt tiếp theo.");
            NextRound(a + 1);
            return;
        }
        if (ListEnemySpawned == null)
        {
            ListEnemySpawned = new List <Enemy>();
        }
        foreach (Enemy LE in listEnemy)
        {
            Vector3 position = TileManager.GetPositionInGoundCurrent();
            Enemy   ene      = EntityManager.Instance.SpawnEnemy(LE, position, PRSpawnEnemy.transform, Data.GetPositionLimit());
            HasMoreEnemy(ene);
        }
    }