/// <summary> /// Gets the village by searching it's id value. /// </summary> /// <param name="id">Village id.</param> /// <returns>Return the village if that village is found with given id value.</returns> public Village GetVillage(int id) { if (Villages.ContainsKey(id)) { return(Villages[id]); } return(null); }
/// <summary> /// Adds a new village to player's villages. /// Fires a new village added event. /// </summary> /// <param name="id">Village id.</param> public void AddVillage(Village v) { if (Villages.ContainsKey(v.Id)) { return; } Villages.Add(v.Id, v); Logger.Trace("{0}, new village added to me.", this); if (VillageAdded != null) { VillageAdded.Invoke(v); } }
/// <summary> /// Removes a village. /// </summary> /// <param name="id">Village id.</param> public void RemoveVillage(int id) { if (!Villages.ContainsKey(id)) { return; } Village v = Villages[id]; Villages.Remove(id); if (VillageRemoved != null) { VillageRemoved.Invoke(v); } }