Beispiel #1
0
 public static float AngleBetween(Vector2 start1, Vector2 end1, Vector2 start2, Vector2 end2)
 {
     return(Abs(Abs(Simplex.GetAngle(end1, start1) - Abs(Simplex.GetAngle(end2, start2)))));
 }
Beispiel #2
0
        protected override void Initialize()
        {
            base.Initialize();
            IsMouseVisible = true;

            uControl.SetDefaultFont = font1;

            #region Test
            Form f = new Form(30, 100, 550, 500, new Color(14, 14, 14))
            {
                IsResizable = true,
                IsVisible   = true
            };
            Button b;
            f.AddNewControl(b = new Button(460, 450, 70, 20, new Color(50, 50, 50))
            {
                Text = "Continue"
            });

            #region Sample text
            //Textarea t;
            //            f.AddNewControl(t = new Textarea(20, 55, 515, 280));

            //            (t as Textarea).Text =
            //@"How to... {#(65,160,216):p}Warp{@p}:
            //            ^n ^n1. Warp {#(65,160,216):h}tech{@p} is commonly used to travel between star systems, but for certain amount of energy or specific fuel to feed your warp core. Press Galaxy Map button (M by default) to view available stars to travel to. The sphere around your current star system shows the bounds within which you can warp.  Now click on any star. The number below star name shows, how much fuel is required to warp to this system. It's labeled as green if you have enough amount of energy and red otherwise. Now choose a reachable star to travel to and press Travel button. The Oscillation window opens. To increase travel stability and speed, you need to alter nodes of the oscillation graph according to the warp noise map: the more accuracy, the more effectivity. Since nodes values are initially precalculated, they also can be left as is, so the travel will take its usual time. Now press Apply button to launch the warp core and travel to the chosen system. Warp can take some time, depending on distance to target star and warp core properties.
            //            ^n ^n2. You also can initiate a wave overlap with the ship that has slower warp core, allowing you to stick with other ships during the travel. When this is possible, an notice appears, which displays current distance to the ship and possibility to do this maneuver: it uses significant amount of energy depending on initial warp jump point.
            //            ^n ^nHow to... Build:
            //            ^n ^n1. Buildings are primary things that makes the world live, cycle and expand. They are subdivided by their functionality: common factories, research laboratories and energy stations. All of them are consuming various resources, depending on how it is organized and supplied. To manage its work in more simple manner, node mechanic is used. Each node requires specific amount of workers and energy to function. There are three types of nodes in the game: source, processing and storage. Source nodes are consuming local resources depending on its type (mining or farming). Processing nodes are used to process incoming resources and provide the result to the next ones. Storage nodes sends all the incoming resources to the planetary storage to be distributed among other factories or for local sales or intake resources for continued processing. If there is a lack of workers or energy, the production will be limited or, in worst case, disabled, so dependency compliance and optimization are very important. If node's inner storage is overfilled, it can cause blocking state - incoming connections are filling up, keep consuming energy and spending working time, calling continued blocking chain, so the losses are increasing.
            //            ^n ^nBuilding sizes can be four types: small, large, complex or arcological. Small ones can contain up to 5 nodes plus one for storage, large can contain up to 20, complex up to 70 and arcological up to 160 nodes.
            //            ^n ^n2. The common factories can be built on wide range of surfaces, even on non-atmosphere planets or asteroids. The size is varied by small (up to 6 processing nodes) They need abundant amount of workers and energy.
            //            ";

            //            (t as Textarea).Font = font1;
            #endregion

            Panel p, pp;
            f.AddNewControl(p  = new Panel(20, 50, 200, 100, Palette.DarkenGray));
            p.AddNewControl(pp = new Panel(10, 10, 180, 80, new Color(40, 40, 40)));

            for (int i = 0; i < 5; i++)
            {
                pp.AddNewControl(b = new Button(10, 10 + 25 * i, 70, 20, new Color(50, 50, 50))
                {
                    Text = "Continue"
                });
            }

            f.CreateLayout(hud_form_headname,
                           hud_form_headseam,
                           hud_form_headend,
                           hud_form_leftborder,
                           hud_form_rightborder,
                           hud_form_bottomleft,
                           hud_form_bottomseam,
                           hud_form_bottomright);

            f.AddNewControl(new Label(10, 12, 170, 20)
            {
                Text = "How to Reference", TextSize = 0.9f, ForeColor = new Color(238, 195, 114)
            });

            FormManager.AddForm("MainForm", f);
            #endregion

            //Examples();

            Simplex.Init(GraphicsDevice);
        }
Beispiel #3
0
 public static Line GetToXLineByOrdinateNormal(Line normal, Vector2 point) => new Line(normal.Start, normal.Start - Simplex.GetRotatedVector2(normal.Angle - (float)PI / 2, normal.PointDistance(point)));
Beispiel #4
0
 public Line Rotate(double add) => new Line(Start, Start + Simplex.GetFormattedVector2(Angle + (float)add, Length));
Beispiel #5
0
 public void Rotate(float add) => End = Start + Simplex.GetFormattedVector2(Angle + add, Length);
Beispiel #6
0
 public float PointDistance(Vector2 pt) => Simplex.PtDistLine(Start, End, pt);
Beispiel #7
0
 public float AngleTo(Line l) => Simplex.AngleBetween(this, l);