public void PrepareNextLevel() { pressTimerPrimary = 500; pressTimerSecondary = 500; pressTimerSpellBrowse = 500; drinkPotionTimer = 500; Level nextLevel; try { nextLevel = Game.Content.Load <Level>("Levels/level" + (castleHandler.Castle.Level + 1)); } catch (Exception ex) { nextLevel = new Level(); } isCurrentLevelABoss = nextLevel.IsBoss; if (isCurrentLevelABoss) { if (!nextLevel.BossCodeName.Equals("None")) { enemyHandler.BossBehaviour = Game.Content.Load <BossBehaviour>("Bosses/" + nextLevel.BossCodeName); } else { enemyHandler.BossBehaviour = null; } } else { enemyHandler.BossBehaviour = null; } string[] spawnEnemiesofTypes = nextLevel.SpawnEnemies.Split(','); spellHandler.NextLevel(); enemyHandler.NextLevel(); castleHandler.NextLevel(nextLevel); player.Mana = player.MaxMana; player.Health = player.MaxHealth; foreach (String s in spawnEnemiesofTypes) { if (s.Equals("Slime1")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Slime); } if (s.Equals("Slime2")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Slime2); } if (s.Equals("Slime3")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Slime3); } if (s.Equals("Slime4")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Slime4); } if (s.Equals("Ghost")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Ghost); } if (s.Equals("Zombie")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Zombie); } if (s.Equals("Skeleton")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Skeleton); } if (s.Equals("Boss")) { enemyHandler.SpawnEnemyTypes.Add(GameObjects.EnemyHandler.Enemies.Boss); } } }