public virtual void SetCoords(Coords coords) { Sector currentSector = this._sector; bool isStarSystem = (this as StarSystem) != null; bool isSystemBody = (this as SystemBody) != null; if (coords != _coords && !InHiperspace && !isStarSystem && !isSystemBody) { if (_coords != null) { OnLeaveSystem(_coords); } if (coords != null) { OnEnterSystem(coords); } } _coords = coords; _sector = coords.GetSector(); if (_sector != currentSector && currentSector != null && !isStarSystem && !isSystemBody) { OnLeaveSector(currentSector); } bool sysIdOk = false; if (!isStarSystem && !isSystemBody) { foreach (var sys in _sector.Systems) { if (sys.Coords == coords) { _systemId = sys.SystemId; sysIdOk = true; } } } if (!sysIdOk) { _systemId = new SystemId(-1, _sector.IndexX, _sector.IndexY); } }
public SectorObject(SerializationInfo info, StreamingContext context) { List <string> sNames = new List <string>(); foreach (var entry in info) { sNames.Add(entry.Name); } this._coords = (Coords)info.GetValue("coord", typeof(Coords)); this._destination = (Coords)info.GetValue("destination", typeof(Coords)); this._speed = info.GetSingle("speed"); this._name = info.GetString("name"); this._sector = _coords.GetSector(); this._systemLocation = (SystemLocation)info.GetValue("sLoc", typeof(SystemLocation)); if (sNames.Contains("dsLoc")) { this._dsystemLocation = (SystemLocation)info.GetValue("dsLoc", typeof(SystemLocation)); } this._destinationStamp = info.GetDateTime("dStp"); this._id = (Guid)info.GetValue("id", typeof(Guid)); this._lastUpdate = info.GetDateTime("stp"); this._systemId = (SystemId)(ulong)info.GetUInt64("sId"); if (sNames.Contains("iHy")) { this.InHiperspace = info.GetBoolean("iHy"); } if (sNames.Contains("iSp")) { this.InHiperspace = info.GetBoolean("iSp"); } if (sNames.Contains("iPl")) { this.InHiperspace = info.GetBoolean("iPl"); } }
public SystemBodyId(ulong systemId, int bodyNumber) { this.systemId = new SystemId(systemId); this.bodyNumber = bodyNumber; }
public SystemBodyId(SystemId systemId, int bodyNumber) { this.systemId = systemId; this.bodyNumber = bodyNumber; }