protected AUnit(Empire empire, UnitId id) { TheEmpire = empire; Id = id; Data = empire.Data->UnitsData[id]; CachedPersistentId = PersistentId; }
public Unit this[PersistentUnitId persistentId] { get { Unit unit = IdLookup[persistentId]; return(unit.Exists ? unit : throw new KeyNotFoundException()); } }
public bool TryGetValue(PersistentUnitId persistentId, out Unit unit) { if (IdLookup.TryGetValue(persistentId, out unit) && unit.Exists) { return(true); } unit = null; return(false); }