/// <summary> /// Load the enemies for a particular area. /// </summary> /// <param name="area">The area to load enemies for.</param> private void LoadEnemies(Globals.Area area) { EnemyRepository enemyRepository = EnemyRepository.LoadFromJSON(); areaEnemies = enemyRepository.GetEnemiesFromArea(area).ToArray(); areaBoss = enemyRepository.GetBossFromArea(area); }
/// <summary> /// Get the boss enemy from an area. /// </summary> /// <param name="area">The area to get the boss from.</param> /// <returns>The boss from an area.</returns> public Enemy GetBossFromArea(Globals.Area area) { Enemy boss = bosses.First(enemy => { string enemyArea = enemy.area.Replace(" ", string.Empty); return(area == (Globals.Area)Enum.Parse(typeof(Globals.Area), enemyArea, false)); } ); return(boss); }
/// <summary> /// Get every regular enemy from an area. /// </summary> /// <param name="area">The area to get enemies from.</param> /// <returns>An IEnumerable containing all enemies from an area.</returns> public IEnumerable <Enemy> GetEnemiesFromArea(Globals.Area area) { IEnumerable <Enemy> enemiesFromArea = enemies.Where(enemy => { string enemyArea = enemy.area.Replace(" ", string.Empty); return(area == (Globals.Area)Enum.Parse(typeof(Globals.Area), enemyArea, false)); } ); return(enemiesFromArea); }
/// <summary> /// Set the battle background. /// </summary> /// <param name="area">The area to set as the background.</param> private void SetBackground(Globals.Area area) { spriteRenderer.sprite = backgrounds[(int)area - 1]; }