コード例 #1
0
 // Called from the Galaxy when a star system is taken, to update the visuals
 public void UpdateColours(int node, Color colour)
 {
     for (int route = 0; route < StarRoutes.Count(); route++)
     {
         bool    alter = false;
         PARoute temp  = StarRoutesOffsets[route];
         {
             if (temp.Node1 == node)
             {
                 temp.Colour1 = colour;
                 alter        = true;
             }
             if (temp.Node2 == node)
             {
                 temp.Colour2 = colour;
                 alter        = true;
             }
         }
         if (alter)
         {
             StarRoutes.RemoveAt(route);
             StarRoutes.Insert(route, temp);
         }
     }
 }
コード例 #2
0
        public Entity_StarRoutes(Scene scene, Vector2[] routes, Vector2[] positions, string path_pa, string path_mod)
        {
            foreach (Vector2 route in routes)
            {
                PARoute paroute = new PARoute();
                {
                    Vector2 half = (positions[(int)route.X] + positions[(int)route.Y]) / 2;

                    paroute.Node1     = (int)route.X;
                    paroute.Position1 = new Vector4(
                        positions[paroute.Node1].X,
                        positions[paroute.Node1].Y,
                        half.X,
                        half.Y
                        );
                    paroute.Colour1   = Helper.Colour_Unowned;
                    paroute.Node2     = (int)route.Y;
                    paroute.Position2 = new Vector4(
                        half.X,
                        half.Y,
                        positions[paroute.Node2].X,
                        positions[paroute.Node2].Y
                        );
                    paroute.Colour2 = Helper.Colour_Unowned;
                }
                // Add original positions for offsets
                StarRoutesOffsets.Add(paroute);
                // Add current for actual use
                StarRoutes.Add(paroute);
                // Add system indices for hiding and displaying logic
                StarIDs.Add(route);
            }

            Layer = Helper.Layer_StarRoute;
        }