/// <summary> /// Method for adding environmental objects to this location. /// </summary> /// <param name="objectToAdd"> The object to add. </param> public void AddObjectToEnvironment(Lootable objectToAdd) { foreach (EnvironmentalObject eo in LocationEnvironment) { if (eo.Details.ID == objectToAdd.ID) { eo.Quantity++; return; } } LocationEnvironment.Add(new EnvironmentalObject(objectToAdd, 1)); }
/// <summary> /// Constructor object for creating new locations. /// </summary> /// <param name="id"> Location ID. </param> /// <param name="name"> Location Name. </param> /// <param name="description"> Location Description. </param> /// <param name="numberEnemy"> Number of enemies at this location. /// </param> /// <param name="itemRequiredEntry"> Item required to enter location. /// </param> /// <param name="lootableHere"> Lootables at this location. </param> /// <param name="questHere"> Quests at this location. </param> /// <param name="enemyHere"> Enemies at this location. </param> public Location(int id, string name, string description, int numberEnemy, Item itemRequiredEntry = null, Lootable lootableHere = null, Quest questHere = null, Enemy enemyHere = null) { ID = id; Name = name; Description = description; ItemRequiredEntry = itemRequiredEntry; QuestHere = questHere; EnemyHere = enemyHere; NumberEnemy = numberEnemy; LootableHere = lootableHere; LocationEnvironment = new List <EnvironmentalObject>(); }
private static void PopulateLootables() { Lootable backpack = new Lootable(LOOTABLE_ID_BACKPACK, "Backpack", "Backpacks", 2, false); backpack.addContent(Items[0]); backpack.addContent(Items[13]); backpack.addContent(Items[12]); backpack.addContent(Items[9]); backpack.addContent(Items[7]); Lootable brokenCar = new Lootable(LOOTABLE_ID_BROKEN_CAR, "Broken Car", "Broken Cars", 4, false); brokenCar.addContent(Items[3]); Lootable luggage = new Lootable(LOOTABLE_ID_LUGGAGE, "Luggage", "Luggage", 3, false); Lootables.Add(backpack); Lootables.Add(brokenCar); Lootables.Add(luggage); }