public override GameObject[] getNewEnemies(int enemiesLeft, int deadPercentage) { if (deadPercentage < killQuest._percentageToBegin) { return(null); } int newWave = Random.Range(0, enemiesLeft); newWave = Mathf.Min(newWave, killQuest._ammount - numspawnedEnemies); if (killQuest._maxPerWave >= 0) { newWave = Mathf.Min(newWave, killQuest._maxPerWave); } if (newWave == 0) { return(null); } GameObject[] newEnemies = new GameObject[newWave]; for (int i = 0; i < newWave; i++) { BasicEnemy enemy = Game.game.spawnEnemy(this.killQuest._enemy); GameObject gameObj = enemy.gameObject; enemy.prefab = killQuest._enemy; enemy.stats.health = (int)(((float)enemy.stats.health) * Game.game.questDifficultyFactor); enemy.stats.experience = (int)(((float)enemy.stats.experience) * Game.game.questExperienceFactor); Attack[] attacks = enemy.GetComponents <Attack>(); if (attacks != null) { foreach (Attack atk in attacks) { atk.minDamage = (int)(((float)atk.minDamage) * Game.game.questDifficultyFactor); atk.maxDamage = (int)(((float)atk.maxDamage) * Game.game.questDifficultyFactor); } } newEnemies[i] = gameObj; numspawnedEnemies++; enemies.Add(gameObj); } return(newEnemies); }