public List <Vector3> GetAllEntryPoints() { List <Vector3> source = new List <Vector3>(); if (this.m_StarSystem != null) { CombatZonePositionInfo zonePositionInfo = this.m_StarSystem.GetCombatZonePositionInfo(this.m_StarSystem.GetFurthestRing() - 1, 0); float num = zonePositionInfo != null ? zonePositionInfo.RadiusUpper : (float)(((double)this.m_StarSystem.GetBaseOffset() + (double)((IEnumerable <float>)Kerberos.Sots.GameStates.StarSystem.CombatZoneMapRadii).Last <float>()) * 5700.0); foreach (NeighboringSystemInfo neighboringSystem in this.m_StarSystem.NeighboringSystems) { Vector3 pos = neighboringSystem.DirFromSystem * num; if (!source.Any <Vector3>((Func <Vector3, bool>)(x => (double)(x - pos).LengthSquared < 10000.0))) { source.Add(pos); } } } return(source); }
public void UpdateSpottedShipsInZone(CombatZonePositionInfo cz) { if (this.m_StarSystem == null || cz == null || cz.Player == 0) { return; } int combatZoneIndex = Kerberos.Sots.GameStates.StarSystem.GetCombatZoneIndex(cz.RingIndex, cz.ZoneIndex); List <Ship> shipList = new List <Ship>(); foreach (KeyValuePair <Ship, bool> enemyShip in this.m_EnemyShips) { if (enemyShip.Key.Player != null && enemyShip.Key.Player.ID == cz.Player && (!enemyShip.Value && combatZoneIndex == this.m_StarSystem.GetCombatZoneIndexAtPosition(enemyShip.Key.Maneuvering.Position))) { shipList.Add(enemyShip.Key); } } foreach (Ship index in shipList) { this.m_EnemyShips[index] = true; } }
public static Matrix GetSpawnTransform(App app, Kerberos.Sots.GameStates.StarSystem starSystem) { List <CombatZonePositionInfo> list = starSystem.NeighboringSystems.Select <NeighboringSystemInfo, CombatZonePositionInfo>((Func <NeighboringSystemInfo, CombatZonePositionInfo>)(x => starSystem.GetEnteryZoneForOuterSystem(x.SystemID))).ToList <CombatZonePositionInfo>(); CombatZonePositionInfo zonePositionInfo1 = (CombatZonePositionInfo)null; Vector3 forward = new Vector3(); float num1 = float.MaxValue; List <StellarBody> stellarBodyList = new List <StellarBody>(); foreach (StellarBody stellarBody in starSystem.GetPlanetsInSystem()) { if (stellarBody.Population != 0.0) { foreach (CombatZonePositionInfo zonePositionInfo2 in list) { Vector3 vector3 = stellarBody.Parameters.Position - zonePositionInfo2.Center; float lengthSquared = vector3.LengthSquared; if ((double)lengthSquared < (double)num1) { num1 = lengthSquared; forward = vector3; zonePositionInfo1 = zonePositionInfo2; } } } } if (zonePositionInfo1 == null) { forward.X = (App.GetSafeRandom().CoinToss(0.5) ? -1f : 1f) * App.GetSafeRandom().NextInclusive(0.0001f, 1f); forward.Y = 0.0f; forward.Z = (App.GetSafeRandom().CoinToss(0.5) ? -1f : 1f) * App.GetSafeRandom().NextInclusive(0.0001f, 1f); double num2 = (double)forward.Normalize(); float num3 = App.GetSafeRandom().NextInclusive(10000f, starSystem.GetSystemRadius()); return(Matrix.CreateWorld(forward * num3, -forward, Vector3.UnitY)); } double num4 = (double)forward.Normalize(); return(Matrix.CreateWorld(zonePositionInfo1.Center, forward, Vector3.UnitY)); }