public void ClearRuntime() { foreach (var building in BuildingFactory.AllBuildings.ToArray()) { BuildingFactory.DestroyBuilding(building); } }
public void SetCapitalOfCiv(ICivilization civ, ICity newCapital) { if (civ == null) { throw new ArgumentNullException("civ"); } if (!CanSetCapitalOfCiv(civ, newCapital)) { throw new InvalidOperationException("CanSetCapitalOfCiv must return true on the given arguments"); } ICity oldCapital; CapitalDictionary.TryGetValue(civ, out oldCapital); if (oldCapital != null) { foreach (var building in BuildingPossessionCanon.GetPossessionsOfOwner(oldCapital).ToArray()) { if (CityConfig.CapitalTemplates.Contains(building.Template)) { BuildingFactory.DestroyBuilding(building); } } } CapitalDictionary[civ] = newCapital; if (newCapital != null) { var templatesInCapital = BuildingPossessionCanon.GetPossessionsOfOwner(newCapital).Select(building => building.Template); foreach (var template in CityConfig.CapitalTemplates.Except(templatesInCapital)) { BuildingFactory.BuildBuilding(template, newCapital); } } }
public void BuildingDestructionRequested() { BuildingFactory.DestroyBuilding(BuildingToDisplay); }