private static StarCollection createStars(IEnumerable <StarSystem> starList) { var stars = new StarCollection(); stars.Add(starList.Select(x => x.Star)); return(stars); }
void Awake() { CurrentStar = transform.parent; _motor = GetComponent <TracerMotor>(); _linker = GetComponent <StarLinker>(); _collectedStars = GameObject.FindObjectOfType <StarCollection>(); }
private static StarCollection createStars(IEnumerable <StarSystemBuilder> starList) { var stars = new StarCollection { starList.Select(x => x.Star) }; return(stars); }
public Route FindRoute( int wptIndex, string icao, string rwy, StarCollection starCol, IReadOnlyList <string> stars) { var editor = wptList.GetEditor(); var handler = new StarHandler(icao, starCol, wptList, editor, airportList); return(finder.FindRoute(wptIndex, new DestInfo(rwy, stars, handler), editor)); }
public void Case3Test() { // Setup var route = new[] { "SIERA", "P1", "STAR1" }; var wptList = new WaypointList(); var wpt = new Waypoint("SIERA", 18.0, 115.0); wptList.AddWaypoint(wpt); var rwy = new Waypoint("VHHH07L", 18.0, 118.0); var p1 = new Waypoint("P1", 18.5, 117.0); var star = new StarEntry( "07L", "STAR1", new[] { p1 }, EntryType.RwySpecific); var stars = new StarCollection(new[] { star }); var extractor = new StarExtractor( route.ToRouteString(), "07L", rwy, wptList, stars); var result = extractor.Extract(); Assert.IsTrue(result.RemainingRoute.SequenceEqual(new[] { "SIERA" })); var destRoute = result.DestRoute; Assert.AreEqual(3, destRoute.Count); var node1 = destRoute.First(); var neighbor1 = node1.AirwayToNext; Assert.IsTrue(node1.Waypoint.Equals(wpt)); Assert.IsTrue("DCT" == neighbor1.Airway); Assert.AreEqual(wpt.Distance(p1), neighbor1.Distance, 1E-8); Assert.AreEqual(0, neighbor1.InnerWaypoints.Count); Assert.AreEqual(InnerWaypointsType.None, neighbor1.Type); var node2 = destRoute.First.Next.Value; var neighbor2 = node2.AirwayToNext; Assert.IsTrue(node2.Waypoint.Equals(p1)); Assert.IsTrue("STAR1" == neighbor2.Airway); Assert.AreEqual(p1.Distance(rwy), neighbor2.Distance, 1E-8); Assert.AreEqual(0, neighbor2.InnerWaypoints.Count); Assert.AreEqual(InnerWaypointsType.Terminal, neighbor2.Type); Assert.IsTrue(destRoute.Last().Waypoint.Equals(rwy)); }
public void RwySpecificAndCommonPart() { var info = new StarCollection(List(RwySpecificPart(), CommonPart())) .GetStarInfo("STAR1", "05", runway05); Assert.AreEqual(new Waypoint("WPTA", 12.0, 21.0), info.FirstWaypoint); Assert.AreEqual(DistanceRwySpecificAndCommonPart(), info.TotalDistance, DistanceEpsilon); }
public void OnlyRwySpecificPart() { var stars = new StarCollection(CreateList(RwySpecificPart())); var info = stars.GetStarInfo("STAR1", "05", runway05); Assert.AreEqual(new Waypoint("WPT01", 11.0, 20.0), info.FirstWaypoint); Assert.AreEqual(DistanceRwySpecificPart(), info.TotalDistance, DistanceEpsilon); }
public StarExtractor( RouteString route, string rwy, Waypoint rwyWpt, WaypointList wptList, StarCollection stars) { this.route = new LinkedList <string>(route); this.rwy = rwy; this.rwyWpt = rwyWpt; this.wptList = wptList; this.stars = stars; }
private static bool ContainResult( StarCollection collection, string sid, string rwy, IReadOnlyList <Waypoint> wpts, EntryType type) { return(collection.StarList.Any(i => i.Name == sid && i.RunwayOrTransition == rwy && i.Waypoints.SequenceEqual(wpts) && i.Type == type)); }
public void Case2Test() { // Setup var route = new[] { "ELATO", "SIERA", "STAR1" }; var wptList = new WaypointList(); var wpt = new Waypoint("SIERA", 18.0, 115.0); wptList.AddWaypoint(wpt); var rwy = new Waypoint("VHHH07L", 18.0, 118.0); var p1 = new Waypoint("P1", 18.5, 117.0); var star = new StarEntry( "07L", "STAR1", new[] { wpt, p1 }, EntryType.RwySpecific); var stars = new StarCollection(new[] { star }); var extractor = new StarExtractor( route.ToRouteString(), "07L", rwy, wptList, stars); var result = extractor.Extract(); Assert.IsTrue(result.RemainingRoute.SequenceEqual(new[] { "ELATO", "SIERA" })); var destRoute = result.DestRoute; Assert.AreEqual(2, destRoute.Count); var node1 = destRoute.First(); var neighbor = node1.AirwayToNext; Assert.IsTrue(node1.Waypoint.Equals(wpt)); Assert.IsTrue("STAR1" == neighbor.Airway); double distance = new[] { wpt, p1, rwy }.TotalDistance(); Assert.AreEqual(distance, neighbor.Distance, 1E-8); Assert.IsTrue(neighbor.InnerWaypoints.SequenceEqual(new[] { p1 })); Assert.AreEqual(InnerWaypointsType.Terminal, neighbor.Type); Assert.IsTrue(destRoute.Last().Waypoint.Equals(rwy)); }
public void RwySpecificAndCommonAndTransitionPart() { var stars = new StarCollection( CreateList( RwySpecificPart(), CommonPart(), TransitionPart())); var info = stars.GetStarInfo("STAR1.TRANS1", "05", runway05); Assert.AreEqual(new Waypoint("WPTBB", 12.0, 22.0), info.FirstWaypoint); Assert.AreEqual(DistanceRwySpecificAndCommonAndTransitionPart(), info.TotalDistance, DistanceEpsilon); }
public Route FindRoute( string origIcao, string origRwy, SidCollection sidCol, IReadOnlyList <string> sids, string destIcao, string destRwy, StarCollection starCol, IReadOnlyList <string> stars) { var editor = wptList.GetEditor(); var sidHandler = new SidHandler(origIcao, sidCol, wptList, editor, airportList); var starHandler = new StarHandler(destIcao, starCol, wptList, editor, airportList); return(finder.FindRoute( new OrigInfo(origRwy, sids, sidHandler), new DestInfo(destRwy, stars, starHandler), editor)); }
public StatesDB(StarCollection stars, WormholeCollection wormholes, PlanetCollection planets, ColonyCollection Colonies, StellarisCollection stellarises, DevelopmentProgressCollection developmentAdvances, ResearchProgressCollection researchAdvances, TreatyCollection treaties, ReportCollection reports, DesignCollection designs, FleetCollection fleets, ColonizationCollection colonizations) { this.Colonies = Colonies; this.Planets = planets; this.Stars = stars; this.Stellarises = stellarises; this.Wormholes = wormholes; this.DevelopmentAdvances = developmentAdvances; this.ResearchAdvances = researchAdvances; this.Reports = reports; this.Designs = designs; this.Fleets = fleets; this.ColonizationProjects = colonizations; this.Treaties = treaties; }
private void InitObjects1() { airportList = new AirportManager(); airportList.Add(GetAirport("ABCD", GetRwyData("05L", 25.0, 121.0))); airportList.Add(GetAirport("EFGH", GetRwyData("07L", 22.0, 113.0))); sids = new SidCollection(new[] { new SidEntry( "05L", "SID1", new[] { new Waypoint("P1", 24.0, 120.0) }, EntryType.RwySpecific, false) }); stars = new StarCollection(new[] { new StarEntry( "07L", "STAR1", new[] { new Waypoint("Q1", 23.0, 114.0) }, EntryType.RwySpecific) }); }
public AnalyzerWithCommands( RouteString route, string origIcao, string origRwy, string destIcao, string destRwy, AirportManager airportList, WaypointList wptList, WaypointListEditor editor, SidCollection sids, StarCollection stars) { this.route = route; this.origIcao = origIcao; this.origRwy = origRwy; this.destIcao = destIcao; this.destRwy = destRwy; this.airportList = airportList; this.wptList = wptList; this.editor = editor; this.sids = sids; this.stars = stars; }
private static Tuple <StatesDB, Player[], Player> loadSaveData(IkonComposite saveData, ObjectDeindexer deindexer, StaticsDB statics) { var stateData = saveData[MainGame.StatesKey].To <IkonComposite>(); var ordersData = saveData[MainGame.OrdersKey].To <IkonArray>(); var stars = new StarCollection(); foreach (var rawData in stateData[StatesDB.StarsKey].To <IEnumerable <IkonComposite> >()) { stars.Add(StarData.Load(rawData, deindexer)); } var planets = new PlanetCollection(); foreach (var rawData in stateData[StatesDB.PlanetsKey].To <IEnumerable <IkonComposite> >()) { planets.Add(Planet.Load(rawData, deindexer)); } var wormholes = new WormholeCollection(); foreach (var rawData in stateData[StatesDB.WormholesKey].To <IEnumerable <IkonComposite> >()) { wormholes.Add(Wormhole.Load(rawData, deindexer)); } var players = new List <Player>(); foreach (var rawData in saveData[MainGame.PlayersKey].To <IEnumerable <IkonComposite> >()) { players.Add(Player.Load(rawData, deindexer)); } var organellePlayer = Player.Load(saveData[MainGame.OrganellePlayerKey].To <IkonComposite>(), deindexer); var developments = new DevelopmentProgressCollection(); foreach (var rawData in stateData[StatesDB.DevelopmentAdvancesKey].To <IEnumerable <IkonComposite> >()) { developments.Add(DevelopmentProgress.Load(rawData, deindexer)); } var research = new ResearchProgressCollection(); foreach (var rawData in stateData[StatesDB.ResearchAdvancesKey].To <IEnumerable <IkonComposite> >()) { research.Add(ResearchProgress.Load(rawData, deindexer)); } var treaties = new TreatyCollection(); foreach (var rawData in stateData[StatesDB.TreatiesKey].To <IEnumerable <IkonComposite> >()) { treaties.Add(Treaty.Load(rawData, deindexer)); } var reports = new ReportCollection(); foreach (var rawData in stateData[StatesDB.ReportsKey].To <IEnumerable <IkonComposite> >()) { reports.Add(ReportFactory.Load(rawData, deindexer)); } var designs = new DesignCollection(); foreach (var rawData in stateData[StatesDB.DesignsKey].To <IEnumerable <IkonComposite> >()) { var design = Design.Load(rawData, deindexer); design.CalcHash(statics); designs.Add(design); deindexer.Add(design.ConstructionProject, design.ConstructionProject.IdCode); } var colonizations = new ColonizationCollection(); foreach (var rawData in stateData[StatesDB.ColonizationKey].To <IEnumerable <IkonComposite> >()) { colonizations.Add(ColonizationProject.Load(rawData, deindexer)); } var fleets = new FleetCollection(); foreach (var rawData in stateData[StatesDB.IdleFleetsKey].To <IEnumerable <IkonComposite> >()) { fleets.Add(Fleet.Load(rawData, deindexer)); } var colonies = new ColonyCollection(); foreach (var rawData in stateData[StatesDB.ColoniesKey].To <IEnumerable <IkonComposite> >()) { colonies.Add(Colony.Load(rawData, deindexer)); } var stellarises = new StellarisCollection(); foreach (var rawData in stateData[StatesDB.StellarisesKey].To <IEnumerable <IkonComposite> >()) { stellarises.Add(StellarisAdmin.Load(rawData, deindexer)); } for (int i = 0; i < players.Count; i++) { players[i].Orders = PlayerOrders.Load(ordersData[i].To <IkonComposite>(), deindexer); } organellePlayer.Orders = PlayerOrders.Load(saveData[MainGame.OrganelleOrdersKey].To <IkonComposite>(), deindexer); return(new Tuple <StatesDB, Player[], Player>( new StatesDB(stars, wormholes, planets, colonies, stellarises, developments, research, treaties, reports, designs, fleets, colonizations), players.ToArray(), organellePlayer )); }
private static bool ContainResultCommonPart(StarCollection collection, string sid, IReadOnlyList <Waypoint> wpts) { return(collection.StarList.Any(i => i.Name == sid && i.Waypoints.SequenceEqual(wpts))); }