private void AddWavePropertiesClick(object sender, RoutedEventArgs e)
        {
            if (StageListView.SelectedItem == null)
            {
                return;
            }
            if (EnemyWaveView.SelectedItem == null)
            {
                return;
            }
            if (WaveItemView.SelectedItem == null)
            {
                return;
            }
            if (WaveModComboBox.SelectedItem == null)
            {
                return;
            }

            EnemyWaveItem s = WaveItemView.SelectedItem as EnemyWaveItem;
            AffixBase     a = WaveModComboBox.SelectedItem as AffixBase;

            if (s.BonusProperties.Contains(a.IdName))
            {
                return;
            }
            s.BonusProperties.Add(a.IdName);
        }
예제 #2
0
    private void SpawnEnemy(EnemyWaveItem enemyWaveItem, Dictionary <BonusType, StatBonus> bonuses, RarityType rarity)
    {
        EnemyBase enemyBase = ResourceManager.Instance.GetEnemyBase(enemyWaveItem.enemyName);
        Spawner   spawner   = SpawnerList[enemyWaveItem.spawnerIndex];

        EnemyActor enemy = EnemyPool.GetEnemy(spawner.transform);

        enemy.ParentSpawner = spawner;
        Vector3 positionOffset = new Vector3(Random.Range(-0.4f, 0.4f), Random.Range(-0.4f, 0.4f), 0);

        //Vector3 positionOffset = new Vector3(-0.5f, -0.5f, 0);
        enemy.positionOffset = positionOffset;
        enemy.rotatedOffset  = positionOffset;

        if (enemyBase.isBoss || enemyWaveItem.isBossOverride)
        {
            enemy.isBoss = true;
        }
        else
        {
            enemy.isBoss = false;
        }

        Sprite enemySprite = ResourceManager.Instance.GetEnemySprite(enemyBase.idName);

        if (enemySprite != null)
        {
            enemy.GetComponent <SpriteRenderer>().sprite = enemySprite;
        }
        else
        {
            Debug.Log("Could not find sprite: " + enemyBase.idName);
        }

        enemy.SetBase(enemyBase, rarity, stageInfo.monsterLevel + survivalLoopCount);

        //Set bonuses from wave
        enemy.Data.SetMobBonuses(bonuses);

        enemy.Init(enemyWaveItem.goalIndex);

        currentEnemyList.Add(enemy);
        enemiesSpawned++;
    }
        private void CopyButtonClickWaveItem(object sender, RoutedEventArgs e)
        {
            if (StageListView.SelectedItem == null)
            {
                return;
            }
            if (EnemyWaveView.SelectedItem == null)
            {
                return;
            }
            if (WaveItemView.SelectedItem == null)
            {
                return;
            }

            EnemyWaveItem temp2 = Helpers.DeepClone((EnemyWaveItem)WaveItemView.SelectedItem);
            EnemyWave     temp  = EnemyWaveView.SelectedItem as EnemyWave;

            temp.EnemyList.Add(temp2);
        }
        private void WaveItemView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            EnemyListItemOptions.IsEnabled = WaveItemView.SelectedItem != null;

            if (WaveItemView.SelectedItem != null && EnemyWaveView.SelectedItem != null)
            {
                EnemyWave     b = EnemyWaveView.SelectedItem as EnemyWave;
                EnemyWaveItem a = WaveItemView.SelectedItem as EnemyWaveItem;



                float delayBetweenSpawns = b.DelayBetweenSpawns;

                if (a.DelayBetweenOverride != 0)
                {
                    delayBetweenSpawns = a.DelayBetweenOverride;
                }

                totalTime.Content = a.EnemyCount * delayBetweenSpawns + a.StartDelay;
            }
        }
        private void RemoveWavePropertiesClick(object sender, RoutedEventArgs e)
        {
            if (StageListView.SelectedItem == null)
            {
                return;
            }
            if (EnemyWaveView.SelectedItem == null)
            {
                return;
            }
            if (WaveItemView.SelectedItem == null)
            {
                return;
            }
            if (WavePropertiesList.SelectedItem == null)
            {
                return;
            }

            EnemyWaveItem s = WaveItemView.SelectedItem as EnemyWaveItem;
            string        a = WavePropertiesList.SelectedItem as string;

            s.BonusProperties.Remove(a);
        }
예제 #6
0
    private IEnumerator SpawnEnemyList(EnemyWaveItem enemyWaveItem, float delayBetween)
    {
        spawnCoroutinesRunning++;

        if (enemyWaveItem.startDelay > 0)
        {
            spawnWarnings[enemyWaveItem.spawnerIndex].AddTimeInfo(new SpawnWarning.TimeInfo(enemyWaveItem.startDelay, currentWave));
        }

        yield return(new WaitForSeconds(enemyWaveItem.startDelay));

        Dictionary <BonusType, StatBonus> bonuses = new Dictionary <BonusType, StatBonus>();

        RarityType rarity = enemyWaveItem.enemyRarity;

        if (isSurvivalBattle)
        {
            int totalWaveCount = survivalLoopCount * Waves.Count + (currentWave + 1);

            StatBonus healthBonus = new StatBonus();
            healthBonus.AddBonus(ModifyType.MULTIPLY, 15 * survivalLoopCount);
            bonuses.Add(BonusType.MAX_HEALTH, healthBonus);

            StatBonus damageBonus = new StatBonus();
            damageBonus.AddBonus(ModifyType.MULTIPLY, 15 * survivalLoopCount);
            bonuses.Add(BonusType.GLOBAL_DAMAGE, damageBonus);
        }

        foreach (string affixName in enemyWaveItem.bonusProperties)
        {
            AffixBase affixBase = ResourceManager.Instance.GetAffixBase(affixName, AffixType.MONSTERMOD);
            foreach (AffixBonusProperty prop in affixBase.affixBonuses)
            {
                StatBonus bonus;
                if (bonuses.ContainsKey(prop.bonusType))
                {
                    bonus = bonuses[prop.bonusType];
                }
                else
                {
                    bonus = new StatBonus();
                    bonuses.Add(prop.bonusType, bonus);
                }
                bonus.AddBonus(prop.modifyType, prop.minValue);
            }
        }

        for (int j = 0; j < enemyWaveItem.enemyCount; j++)
        {
            int rarityMod = 0;
            if (survivalLoopCount > 0 && rarity < RarityType.RARE)
            {
                float rarityBoostIncrement = 0.05f;
                if (rarity == RarityType.NORMAL)
                {
                    rarityBoostIncrement = 0.08f;
                }

                float totalRarityBoostChance = survivalLoopCount * rarityBoostIncrement;
                if (Random.Range(0, 1f) < totalRarityBoostChance)
                {
                    rarityMod++;
                    if (rarity == RarityType.NORMAL && totalRarityBoostChance > 1f && Random.Range(0, 1f) < (1f - totalRarityBoostChance))
                    {
                        rarityMod++;
                    }
                }
            }
            SpawnEnemy(enemyWaveItem, bonuses, rarity + rarityMod);
            yield return(new WaitForSeconds(delayBetween));
        }
        spawnCoroutinesRunning--;
        yield break;
    }