Exemplo n.º 1
0
    public void GenerateEnemyList(int waveIndex)
    {
        this.currentWaveIndex = waveIndex;

        StageInfoContainer stageInfo = GameManager.Instance.gameState.GetCurrentStage();
        WaveInfoContainer  waveInfo  = stageInfo.GetWaveInfo(this.currentWaveIndex);

        List <JobActionsList> enemyList = waveInfo.GetEnemyList();

//        float mult = stageInfo.GetDifficultyMult();
        BattleType battleType = stageInfo.GetBattleType();

        for (int i = 0; i < enemyList.Count; i++)
        {
            JobActionsList jobList = enemyList[i];
            string         name    = jobList.prefab.Name + " (" + GetTargetNameFromIndex(i) + ")";
            int            index   = i;

            Enemy enemy = new Enemy();
            enemy.Initialize(jobList, name);
            EnemyObject instantiatedEnemy = enemy.InstantiateFromJob <EnemyObject>(jobList, name, index);

            // Apply stat adjustments based on difficulty

            PlayerStats stats = instantiatedEnemy.stats;

            /*
             * foreach(Stat stat in System.Enum.GetValues(typeof(Stat))) {
             *  stats.ModifyStat(stat, (int) (stats.GetStat(stat) * mult));
             * }
             */
            int level = waveInfo.GetWaveInfo().averageLevel;

            if (battleType == BattleType.HARD_BATTLE)
            {
                level += 3;
            }
            else if (battleType == BattleType.EASY_BATTLE)
            {
                level -= 1;
            }
            else if (battleType == BattleType.BOSS)
            {
                // level += 10; // Should be done from inspector side
            }

            stats.ApplyStatsBasedOnLevel(level);

            // TODO: Some sort of entrance animation

            instantiatedEnemy.SetSortingOrder(i);
            FighterSlot slot = enemySlots[i];
            slot.InitializePosition(instantiatedEnemy);

            GameManager.Instance.gameState.enemyParty.SetFighter(i, enemy);
        }
    }