private Zone(SystemBody systemBody, ulong zoneId, bool generate) { this.SystemBody = systemBody; this.ZoneId = zoneId; if (generate) { GenerateZone(); } }
public override bool Equals(object obj) { SystemBody sObj = obj as SystemBody; if (!Object.ReferenceEquals(sObj, null)) { return(this._systemBodyId == sObj._systemBodyId && this.starSystem.SystemId == sObj.starSystem.SystemId); } return(false); }
public static int CalculateNumZones(SystemBody body) { float hz = body.StarSystem.HZone; float baseDistance = body.OrbitalRadius / hz; if (baseDistance > 0.5 && baseDistance < 10) { int min = 0; int max = 5; switch (body.BodyType) { case SystemBodyType.Asteroid: min = 0; max = 1; break; case SystemBodyType.GasGiant: return(0); case SystemBodyType.IceWorld: min = 0; max = 4; break; case SystemBodyType.Inferno: min = 0; max = 1; break; case SystemBodyType.RingedGasGiant: return(0); case SystemBodyType.RockyPlanetoid: min = 0; max = 1; break; case SystemBodyType.RockyWorld: min = 0; max = 3; break; case SystemBodyType.SubGasGiant: return(0); case SystemBodyType.Terrestrial: min = 2; max = 8; break; case SystemBodyType.Venuzian: return(0); case SystemBodyType.WaterWorld: min = 1; max = 4; break; } Random rand = new Random((int)body.SystemId.Id >> 4); int num = rand.Next(min, max); return(num); } else { return(0); } }
public static void UpdateLocation(SystemBody body) { double angle = body.BaseAngle; double radius = body.OrbitalRadius; double period = body.OrbitalPeriod; StarDate baseDate = StarDate.GetStarDate(new DateTime(2012, 1, 1)); //StarDate currentDate = StarDate.Now; //Passou a estar fixo pois estava com alguma dificuldade em manter as coisas em orbita ;P StarDate currentDate = StarDate.GetStarDate(new DateTime(2024, 1, 1)); TimeSpan span = currentDate.Date.Subtract(baseDate.Date); angle += ((span.TotalDays / 365.25) * period * 360); double rad = 0.0174532925; double ssX = (long)(radius * Math.Cos(angle * rad) * 149598000); double ssY = (long)(radius * Math.Sin(angle * rad) * 149598000); double ssZ = 0; body.SystemLocation.SetInSystemCoords(ssX, ssY, ssZ); }
public Zone(SystemBody systemBody, ulong zoneId) : this(systemBody, zoneId, true) { }
public Zone(SystemBody systemBody, ulong zoneId, Generator.Block block) : this(systemBody, zoneId, false) { this._block = block; }