private void setupBodies() { var starTransform = Matrix4.CreateScale(StarScale); this.UpdateScene( ref this.starSprite, new SceneObject(new PolygonData( StarColorZ, new SpriteData(starTransform, GalaxyTextures.Get.SystemStar.Id, controller.Star.Color, null, true), SpriteHelpers.UnitRect(GalaxyTextures.Get.SystemStar).ToList() )) ); this.UpdateScene( ref this.planetSprites, this.controller.Planets.Select(planet => new SceneObject(planetSpriteData(planet))).ToList() ); this.UpdateScene( ref this.planetOrbits, this.controller.Planets.Select( planet => { var orbitR = planet.OrdinalPosition * OrbitStep + OrbitOffset; var color = planet.Owner != null ? planet.Owner.Color : Color.FromArgb(64, 64, 64); return(new SceneObject(new PolygonData( OrbitZ, new OrbitData(orbitR - OrbitWidth / 2, orbitR + OrbitWidth / 2, color, Matrix4.Identity, GalaxyTextures.Get.PathLine), OrbitHelpers.PlanetOrbit(orbitR, OrbitWidth, OrbitPieces).ToList() ))); } ).ToList() ); }
protected void setupSystem(ICollection <PlanetInfo> planets, Func <PlanetInfo, ColonyInfo> colonies) { this.maxOffset = (planets.Count + 1) * OrbitStep + OrbitOffset; this.lastMousePosition = null; this.UpdateScene( ref this.planetOrbits, planets.Select( planet => { var orbitR = planet.Position * OrbitStep + OrbitOffset; var colony = colonies(planet); var color = colony != null ? Color.FromArgb(192, colony.Owner.Color) : Color.FromArgb(64, 64, 64); return(new SceneObject(new PolygonData( OrbitZ, new OrbitData(orbitR - OrbitWidth / 2, orbitR + OrbitWidth / 2, color, Matrix4.Identity, GalaxyTextures.Get.PathLine), OrbitHelpers.PlanetOrbit(orbitR, OrbitWidth, OrbitPieces).ToList() ))); } ).ToList() ); foreach (var anchor in this.planetAnchors.Values) { this.RemoveAnchor(anchor); } this.planetAnchors = new Dictionary <PlanetInfo, GuiAnchor>(); foreach (var planet in planets) { var anchor = new GuiAnchor(planet.Position * OrbitStep + OrbitOffset, 0); this.planetAnchors[planet] = anchor; this.AddAnchor(anchor); } }
private void setupBodies() { this.UpdateScene( ref this.planetOrbits, this.controller.Planets.Select( planet => { var orbitR = planet.Position * OrbitStep + OrbitOffset; var colony = controller.PlanetsColony(planet); var color = colony != null ? Color.FromArgb(192, colony.Owner.Color) : Color.FromArgb(64, 64, 64); return(new SceneObject(new PolygonData( OrbitZ, new OrbitData(orbitR - OrbitWidth / 2, orbitR + OrbitWidth / 2, color, Matrix4.Identity, GalaxyTextures.Get.PathLine), OrbitHelpers.PlanetOrbit(orbitR, OrbitWidth, OrbitPieces).ToList() ))); } ).ToList() ); }