Пример #1
0
 protected ACity(Empire empire, CityId id)
 {
     TheEmpire          = empire;
     Id                 = id;
     Data               = empire.Data->CitiesData[id];
     CachedPersistentId = PersistentId;
     TheEmpire.OnStartOfTurnOrResume += () => _maintenance = -1;
 }
Пример #2
0
 public City this[PersistentCityId persistentId]
 {
     get
     {
         if (CityObjects.Count < Count)
         {
             Update();
         }
         City city = IdLookup[persistentId];
         return(city.Exists ? city : throw new KeyNotFoundException());
     }
 }
Пример #3
0
 public bool TryGetValue(PersistentCityId persistentId, out City city)
 {
     if (CityObjects.Count < Count)
     {
         Update();
     }
     if (IdLookup.TryGetValue(persistentId, out city) && city.Exists)
     {
         return(true);
     }
     city = null;
     return(false);
 }