Beispiel #1
0
    private void SpawnEnemyForWaveWithType(EnemyTypeEnum type)
    {
        WaveEnemyConfigMetadata waveConfig = waveConfigDictionary[currentWave];
        int enemyQuantity = 0;

        needLevelUp = false;

        switch (type)
        {
        case EnemyTypeEnum.AVERAGE:
            enemyQuantity = waveConfig.averageEnemyQuantity;
            break;

        case EnemyTypeEnum.ATTACK:
            enemyQuantity = waveConfig.attackEnemyQuantity;
            break;

        case EnemyTypeEnum.DEFEND:
            enemyQuantity = waveConfig.defendEnemyQuantity;
            break;

        case EnemyTypeEnum.SMALL_BOSS:
            enemyQuantity = waveConfig.smallBossQuantity;
            if (enemyQuantity > 0)
            {
                needLevelUp = true;
            }
            break;

        case EnemyTypeEnum.BIG_BOSS:
            enemyQuantity = waveConfig.bigBossQuantity;
            if (enemyQuantity > 0)
            {
                needLevelUp = true;
            }
            break;
        }

        if (enemyQuantity == 0)
        {
            return;
        }

        aliveEnemyQuantity += enemyQuantity * enemySpawnLocations.Length;

        string key = GetKeyForEnemyConfig(currentWave, type);

        if (!enemyConfigDictionary.ContainsKey(key))
        {
            Debug.LogError("Can't find " + key + " config in enemyConfigDictionary");
        }
        EnemyMetadata config = enemyConfigDictionary[key];

        for (int i = 0; i < enemySpawnLocations.Length; i++)
        {
            SpawnEnemyWithConfig(enemySpawnLocations[i], enemyQuantity, config);
        }
    }
Beispiel #2
0
    public List <WaveEnemyConfigMetadata> GetWaveEnemyConfigMeatadata()
    {
        if (configList != null)
        {
            return(configList);
        }
        configList = new List <WaveEnemyConfigMetadata>();

        SqliteCommand    cmd    = sqlHelper.CreateTextCommand("SELECT * FROM wave_enemy_config");
        SqliteDataReader reader = sqlHelper.ExecuteCommand(cmd);

        while (reader.Read())
        {
            WaveEnemyConfigMetadata row = new WaveEnemyConfigMetadata(reader);
            configList.Add(row);
        }
        sqlHelper.CloseResultReader(reader);

        return(configList);
    }