static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            Vector2D[] noseconevertecies = new Vector2D[]
            {
                new Vector2D(10, 10),
                new Vector2D(0, 20),
                new Vector2D(-10, 25),
                new Vector2D(-10, -25),
                new Vector2D(0, -20),
                new Vector2D(10, -10),
            };
            Vector2D[] mainhullvertecies = new Vector2D[]
            {
                new Vector2D(10, 25),
                new Vector2D(0, 40),

                new Vector2D(-10, 40),
                new Vector2D(-40, 20),
                new Vector2D(-40, -20),
                new Vector2D(-10, -40),

                new Vector2D(0, -40),
                new Vector2D(10, -25)
            };
            IGeometry2D mainhull = new Polygon2D(ALVector2D.Zero, mainhullvertecies);
            IGeometry2D nosecone = new Polygon2D(new ALVector2D(0, new Vector2D(20.5f, 0)), noseconevertecies);

            DefaultShape = new RigidBodyTemplate(20, 654.58713987691476f, new IGeometry2D[] { mainhull, nosecone }, new Coefficients[] { DefaultCoefficients, DefaultCoefficients });
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #2
0
        static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            Vector2D[] mainhullvertecies = new Vector2D[]
            {
                new Vector2D(10, 15),
                new Vector2D(-40, 20),
                new Vector2D(-40, -20),
                new Vector2D(10, -15)
            };
            Vector2D[] leftWingvertecies = new Vector2D[]
            {
                new Vector2D(40, 10),
                new Vector2D(-30, 2),
                new Vector2D(-50, -30),
                new Vector2D(-40, -30)
            };
            int length = leftWingvertecies.Length;

            Vector2D[] RightWingvertecies = new Vector2D[]
            {
                new Vector2D(-40, 30),
                new Vector2D(-50, 30),
                new Vector2D(-30, -2),
                new Vector2D(40, -10)
            };
            IGeometry2D mainhull  = new Polygon2D(ALVector2D.Zero, mainhullvertecies);
            IGeometry2D leftWing  = new Polygon2D(new ALVector2D(0, new Vector2D(-10, -20)), leftWingvertecies);
            IGeometry2D RightWing = new Polygon2D(new ALVector2D(0, new Vector2D(-10, 20)), RightWingvertecies);

            DefaultShape = new RigidBodyTemplate(13, 869.439914791763f, new IGeometry2D[] { mainhull, RightWing, leftWing }, new Coefficients[] { DefaultCoefficients, DefaultCoefficients, DefaultCoefficients });
            DefaultShape.BalanceBody();
            //DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #3
0
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] bulletverticies = new Vector2D[]
            {
                new Vector2D(30, 10),
                new Vector2D(-10, 10),
                new Vector2D(0, -10),
                new Vector2D(10, -10),
            };
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            for (int pos = 0; pos < 4; ++pos)
            {
                goes.Add(new Polygon2D(
                             new ALVector2D(MathHelper.PI * .5f * pos, Vector2D.FromLengthAndAngle(10, MathHelper.PI * .5f * pos)),
                             bulletverticies));
                coes.Add(coe);
            }
            DefaultShape = new RigidBodyTemplate(.9f, 429.46676883367536f, goes.ToArray(), coes.ToArray());
            //DefaultShape.BalanceBody();
            ////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #4
0
            static void InitShape()
            {
                Coefficients DefaultCoefficients = TimeWarp.Coefficients;

                Vector2D[] mainhullvertecies = new Vector2D[]
                {
                    //new Vector2D(60,0),
                    new Vector2D(60, 8),
                    new Vector2D(0, 15),
                    new Vector2D(-40, 15),
                    new Vector2D(-40, -15),
                    new Vector2D(0, -15),
                    new Vector2D(60, -8)
                };
                List <Coefficients> ceos = new List <Coefficients>();
                List <IGeometry2D>  goes = new List <IGeometry2D>();

                ceos.Add(DefaultCoefficients);
                goes.Add(new Polygon2D(ALVector2D.Zero, mainhullvertecies));
                float width = 70;

                for (int pos = -30; pos < 60; pos += 20)
                {
                    width -= 5;
                    ceos.Add(DefaultCoefficients);
                    goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(pos, 0)), Polygon2D.FromRectangle(width, 10)));
                }

                DefaultShape = new RigidBodyTemplate(9, 947.32712172484457f, goes.ToArray(), ceos.ToArray());
                DefaultShape.BalanceBody();
                ////DefaultShape.CalcInertiaMultiplier(.1f);
            }
        static void InitShapes()
        {
            DefaultCoefficients = new Coefficients(1.1f, .2f, .2f);
            int length = 6;

            Templates = new RigidBodyTemplate[length];
            List <Vector2D> vertexes = new List <Vector2D>();

            for (int pos = 0; pos < length; ++pos)
            {
                int        numberofSides = rand.Next(5, 10);
                float      radius        = 20 + (float)rand.NextDouble() * 20;
                Vector2D[] poly          = Polygon2D.FromNumberofSidesAndRadius(numberofSides, radius);
                vertexes.AddRange(poly);
                for (int numbertoRemove = rand.Next(0, numberofSides - 4); numbertoRemove > 0; --numbertoRemove)
                {
                    vertexes.RemoveAt(rand.Next(0, vertexes.Count));
                }
                Polygon2D polly = new Polygon2D(ALVector2D.Zero, poly);
                poly = Polygon2D.MakeCentroidOrigin(vertexes.ToArray());
                MassInertia mi = MassInertia.FromSolidCylinder(1 + (float)rand.NextDouble() * 2, polly.BoundingRadius);
                Templates[pos] = new RigidBodyTemplate(mi, new IGeometry2D[] { polly }, new Coefficients[] { DefaultCoefficients });
                vertexes.Clear();
            }
        }
Exemple #6
0
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  geometries          = new List <IGeometry2D>();
            List <Coefficients> coefficients        = new List <Coefficients>();

            float da        = MathHelper.PI * 2 / 5;
            float podlength = 50;

            for (float angle = 0; angle < MathHelper.PI * 2; angle += da)
            {
                Vector2D direction = Vector2D.Rotate(angle - MathHelper.PI, Vector2D.XAxis);
                if (angle == 0)
                {
                    geometries.Add(new Polygon2D(new ALVector2D(angle - MathHelper.PI, direction * .3f * podlength), Polygon2D.FromRectangle(9, podlength * .6f)));
                    geometries.Add(new Polygon2D(new ALVector2D(0, direction * podlength * .6f), Polygon2D.FromNumberofSidesAndRadius(8, 10)));
                }
                else
                {
                    geometries.Add(new Polygon2D(new ALVector2D(angle - MathHelper.PI, direction * .5f * podlength), Polygon2D.FromRectangle(9, podlength)));
                    geometries.Add(new Polygon2D(new ALVector2D(0, direction * podlength), Polygon2D.FromNumberofSidesAndRadius(8, 10)));
                }
                coefficients.Add(DefaultCoefficients);
                coefficients.Add(DefaultCoefficients);
            }
            geometries.Add(new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(10, 15)));
            coefficients.Add(DefaultCoefficients);
            DefaultShape = new RigidBodyTemplate(16, 1569.670392957858f, geometries.ToArray(), coefficients.ToArray());
            DefaultShape.BalanceBody();
            // ////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #7
0
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] engineconevertecies = new Vector2D[]
            {
                new Vector2D(-50, 10),
                new Vector2D(-100, 20),
                new Vector2D(-100, -20),
                new Vector2D(-50, -10)
            };
            Vector2D offset = Polygon2D.CalcCentroid(engineconevertecies);

            //engineconevertecies = Vector2D.Translate( -offset,engineconevertecies);

            OperationHelper.ArrayRefOp <Vector2D, Vector2D, Vector2D>(
                engineconevertecies,
                ref offset,
                engineconevertecies,
                Vector2D.Subtract);

            goes.Add(new Polygon2D(ALVector2D.Zero, Polygon2D.FromRectangle(20, 150)));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-100, 0)), Polygon2D.FromNumberofSidesAndRadius(10, 20)));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(0, offset), engineconevertecies));
            coes.Add(DefaultCoefficients);
            DefaultShape = new RigidBodyTemplate(18, 3383.9114375372737f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();
            ////DefaultShape.CalcInertiaMultiplier(.1f);
        }
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] hullvertecies = new Vector2D[]
            {
                new Vector2D(30, 13),
                new Vector2D(0, 18),
                new Vector2D(-30, 20),
                new Vector2D(-30, -20),
                new Vector2D(0, -18),
                new Vector2D(30, -13)
            };
            goes.Add(new Polygon2D(new ALVector2D(0, hullvertecies[0]), Polygon2D.FromNumberofSidesAndRadius(8, 12)));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, hullvertecies[5]), Polygon2D.FromNumberofSidesAndRadius(8, 12)));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, hullvertecies[2]), Polygon2D.FromNumberofSidesAndRadius(8, 12)));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, hullvertecies[3]), Polygon2D.FromNumberofSidesAndRadius(8, 12)));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(ALVector2D.Zero, hullvertecies));
            coes.Add(DefaultCoefficients);
            DefaultShape = new RigidBodyTemplate(7, 771.453f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();
            //DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #9
0
 public Ship(
     LifeSpan lifeTime,
     PhysicsState physicsState,
     BodyFlags flags,
     RigidBodyTemplate template,
     ShipMovementInfo movementInfo,
     ShipState shipState,
     ControlableSounds controlableSounds,
     ShipSounds shipSounds,
     ActionList actions,
     IShip[] subShips)
     : base(
         lifeTime,
         physicsState,
         flags,
         template,
         movementInfo,
         shipState,
         controlableSounds)
 {
     this.UQMFlags       |= ContFlags.CanDoGravityWhip;
     this.shipSounds      = shipSounds;
     this.subShips        = subShips;
     this.actions         = actions;
     this.controlableType = ControlableType.Ship;
 }
Exemple #10
0
        static void InitShape()
        {
            Coefficients coe  = TimeWarp.Coefficients;
            IGeometry2D  hull = new Polygon2D(ALVector2D.Zero, Polygon2D.FromSquare(10));

            DefaultShape = new RigidBodyTemplate(MassInertia.FromSquare(.01f, 10), new IGeometry2D[] { hull }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
        }
        static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            DefaultShape = new RigidBodyTemplate(MassInertia.FromSolidCylinder(.01f, 90), new IGeometry2D[] { new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(10, 20)) }, new Coefficients[] { DefaultCoefficients });
            //DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #12
0
        static void InitShape()
        {
            Coefficients coe        = TimeWarp.Coefficients;
            IGeometry2D  enginecone = new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(6, 6));

            DefaultShape = new RigidBodyTemplate(.001f, 9.012392754810497f, new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #13
0
            static void InitShape()
            {
                Coefficients coe = TimeWarp.Coefficients;

                IGeometry2D enginecone = new Polygon2D(new ALVector2D(0, new Vector2D(0, 0)), Polygon2D.FromNumberofSidesAndRadius(8, 8));

                DefaultShape = new RigidBodyTemplate(MassInertia.FromSolidCylinder(.1f, 8), new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
                DefaultShape.BalanceBody();
            }
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            DefaultShape = new RigidBodyTemplate(MassInertia.FromSolidCylinder(.01f, 7),
                                                 new IGeometry2D[] { new Polygon2D(Polygon2D.FromNumberofSidesAndRadius(10, 7)) },
                                                 new Coefficients[] { coe });
            DefaultShape.BalanceBody();
        }
        static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;
            IGeometry2D  mainhull            = new Polygon2D(new ALVector2D(0, new Vector2D(35, 0)), Polygon2D.FromRectangle(50, 20));
            IGeometry2D  engine = new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(10, 40));

            DefaultShape = new RigidBodyTemplate(18, 1239.4170508254688f, new IGeometry2D[] { mainhull, engine, }, new Coefficients[] { DefaultCoefficients, DefaultCoefficients });
            DefaultShape.BalanceBody();
            ////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #16
0
        static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            IGeometry2D mainhull = new Polygon2D(new ALVector2D(0, new Vector2D(40, 0)), Polygon2D.FromRectangle(10, 50));
            IGeometry2D engine   = new Circle2D(20, new Vector2D(0, 0));

            DefaultShape = new RigidBodyTemplate(2, 1935.8061672698966f, new IGeometry2D[] { engine, mainhull }, new Coefficients[] { DefaultCoefficients, DefaultCoefficients });
            //DefaultShape.BalanceBody();
            //DefaultShape.CalcInertiaMultiplier(.1f);
        }
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            goes.Add(new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(6, 20)));
            coes.Add(coe);

            DefaultShape = new RigidBodyTemplate(MassInertia.FromSolidCylinder(1, 20), goes.ToArray(), coes.ToArray());
        }
        static void InitShape()
        {
            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            Vector2D[] Pod1p =
                new Vector2D[] {
                new Vector2D(50, -15),
                new Vector2D(80, 15),
                new Vector2D(-50, 15),
                new Vector2D(-50, -15)
            };
            Vector2D[] Pod2p =
                new Vector2D[] {
                new Vector2D(-50, -15),
                new Vector2D(80, -15),
                new Vector2D(50, 15),
                new Vector2D(-50, 15)
            };
            Vector2D[] bridgep =
                new Vector2D[] {
                new Vector2D(-35, 20),
                new Vector2D(-35, -20),
                new Vector2D(-22, -44),
                new Vector2D(-10, -50),
                new Vector2D(20, -50),
                new Vector2D(20, 50),
                new Vector2D(-10, 50),
                new Vector2D(-22, 44)
            };


            Vector2D[]    mainhullp = Polygon2D.FromRectangle(50, 150);
            Vector2D[]    subhullp  = Polygon2D.FromRectangle(100, 30);
            IGeometry2D[] geometry  = new IGeometry2D[5];


            geometry[0] = new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(-10, 0)), subhullp);
            geometry[1] = new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(0, 50)), Pod1p);
            geometry[2] = new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(0, -50)), Pod2p);
            geometry[3] = new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(0, 0)), mainhullp);
            geometry[4] = new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(90, 0)), bridgep);

            Coefficients[] coefficients = new Coefficients[5];
            for (int pos = 0; pos < 5; ++pos)
            {
                coefficients[pos] = DefaultCoefficients;
            }

            DefaultShape = new RigidBodyTemplate(20, 3907.8407737525167f, geometry, coefficients);
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
        /// <summary>
        /// Initializes the ships shape.
        /// </summary>
        static void InitShape()
        {
            //This method is complicated and i dont fell like commenting it.
            // this one is actaully very simple compared to the rest but still anoying.

            Coefficients DefaultCoefficients = TimeWarp.Coefficients;

            DefaultShape = new RigidBodyTemplate(
                MassInertia.FromSolidCylinder(4, 20),
                new IGeometry2D[] { new Polygon2D(ALVector2D.Zero, Polygon2D.FromNumberofSidesAndRadius(10, 20)) },
                new Coefficients[] { DefaultCoefficients });
            //DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] leftmainhullvertecies = new Vector2D[]
            {
                new Vector2D(50, 2),
                new Vector2D(-50, 2),
                new Vector2D(-50, -20),
                new Vector2D(0, -25),
                new Vector2D(70, -10)
            };
            Vector2D[] Rightmainhullvertecies = new Vector2D[]
            {
                new Vector2D(50, -2),
                new Vector2D(70, 10),
                new Vector2D(0, 25),
                new Vector2D(-50, 20),
                new Vector2D(-50, -2),
            };
            Vector2D[] leftWingvertecies = new Vector2D[]
            {
                new Vector2D(10, 10),
                new Vector2D(-30, 10),
                new Vector2D(-20, -50),
                new Vector2D(0, -50)
            };
            Vector2D[] RightWingvertecies = new Vector2D[]
            {
                new Vector2D(0, 50),
                new Vector2D(-20, 50),
                new Vector2D(-30, -10),
                new Vector2D(10, -10)
            };
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, -30)), leftWingvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, 30)), RightWingvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(0, -6)), leftmainhullvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(0, 6)), Rightmainhullvertecies));
            coes.Add(DefaultCoefficients);

            DefaultShape = new RigidBodyTemplate(22, 1891.9877824710443f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
 protected Asteroid(RigidBodyTemplate template, PhysicsState physicsState)
     : base(
         (LifeSpan)DefaultLifeTime.Clone(),
         physicsState,
         BodyFlags.None,
         template,
         new ShipMovementInfo(DefaultShipMovementInfo),
         new ShipState(rand.Next(1, 6)),
         new ControlableSounds(),
         new WeaponsLogic(TargetingInfo.None,
                          new EffectCollection(DefaultEffectCollection)))
 {
     this.factionInfo     = new FactionInfo(AsteroidFaction);
     this.controlableType = ControlableType.Debris | ControlableType.Weapon;
     this.weaponInfo.EffectCollection.AttachmentFlags = EffectAttachmentFlags.WeaponExpires;
 }
Exemple #22
0
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] hullverticies = new Vector2D[]
            {
                new Vector2D(5, 5),
                new Vector2D(-5, 5),
                new Vector2D(-5, -5),
                new Vector2D(5, -5)
            };
            IGeometry2D hull = new Polygon2D(ALVector2D.Zero, hullverticies);

            DefaultShape = new RigidBodyTemplate(MassInertia.FromRectangle(.1f, 10, 10), new IGeometry2D[] { hull }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
        }
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] bulletverticies = new Vector2D[]
            {
                new Vector2D(5, 2),
                new Vector2D(-5, 3),
                new Vector2D(-5, -3),
                new Vector2D(5, -2)
            };
            IGeometry2D enginecone = new Polygon2D(ALVector2D.Zero, bulletverticies);

            DefaultShape = new RigidBodyTemplate(.001f, 10.549201161945275f, new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
            ////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #24
0
            static void InitShape()
            {
                Coefficients coe = TimeWarp.Coefficients;

                Vector2D[] bulletverticies = new Vector2D[]
                {
                    new Vector2D(15, 2.5f),
                    new Vector2D(-15, 2.5f),
                    new Vector2D(-15, -2.5f),
                    new Vector2D(15, -2.5f)
                };
                IGeometry2D enginecone = new Polygon2D(ALVector2D.Zero, bulletverticies);

                DefaultShape = new RigidBodyTemplate(.01f, 77.585000000013721f, new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
                DefaultShape.BalanceBody();
                ////DefaultShape.CalcInertiaMultiplier(.1f);
            }
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] bulletverticies = new Vector2D[]
            {
                new Vector2D(0, 5),
                new Vector2D(-10, 0),
                new Vector2D(0, -5),
                new Vector2D(10, 0)
            };
            IGeometry2D enginecone = new Polygon2D(ALVector2D.Zero, bulletverticies);

            DefaultShape = new RigidBodyTemplate(.01f, 149.2709355885475f, new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
        RigidBodyTemplate GetPrimaryWeaponShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] bulletverticies = new Vector2D[]
            {
                new Vector2D(30, 5),
                new Vector2D(-30, 5),
                new Vector2D(-30, -5),
                new Vector2D(30, -5)
            };
            IGeometry2D       enginecone   = new Polygon2D(ALVector2D.Zero, bulletverticies);
            RigidBodyTemplate DefaultShape = new RigidBodyTemplate(MassInertia.FromRectangle(1, 10, 2), new IGeometry2D[] { enginecone }, new Coefficients[] { coe });

            DefaultShape.BalanceBody();
            return(DefaultShape);
        }
Exemple #27
0
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] pods = Polygon2D.FromRectangle(10, 70);


            Vector2D[] leftWingvertecies = new Vector2D[]
            {
                new Vector2D(25, 20),
                new Vector2D(-30, 20),
                new Vector2D(-40, -50),
                new Vector2D(-5, -50)
            };
            Vector2D[] RightWingvertecies = new Vector2D[]
            {
                new Vector2D(-5, 50),
                new Vector2D(-40, 50),
                new Vector2D(-30, -20),
                new Vector2D(25, -20)
            };
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, -30)), leftWingvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, 30)), RightWingvertecies));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(-35, 75)), pods));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(-35, -75)), pods));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(20, 0)), Polygon2D.FromRectangle(20, 120)));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(90, 0)), Polygon2D.FromNumberofSidesAndRadius(5, 25)));
            coes.Add(DefaultCoefficients);


            DefaultShape = new RigidBodyTemplate(18, 3923.7657051329197f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();

            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
Exemple #28
0
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] mainhullvertecies = new Vector2D[]
            {
                new Vector2D(40, 0),
                //new Vector2D(20,10),
                //new Vector2D(20,15),
                new Vector2D(-8, 20),
                new Vector2D(-8, -20),
                //new Vector2D(20,-15),
                //new Vector2D(20,-10)
            };
            Vector2D[] leftWingvertecies = new Vector2D[]
            {
                new Vector2D(10, 20),
                new Vector2D(-30, 10),
                new Vector2D(0, -50),
                new Vector2D(40, -80)
            };
            int length = leftWingvertecies.Length;

            Vector2D[] RightWingvertecies = new Vector2D[]
            {
                new Vector2D(40, 80),
                new Vector2D(0, 50),
                new Vector2D(-30, -10),
                new Vector2D(10, -20)
            };

            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, -20)), leftWingvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(-10, 20)), RightWingvertecies));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(30, 0)), Polygon2D.FromRectangle(20, 120)));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(80, 0)), mainhullvertecies));
            coes.Add(DefaultCoefficients);
            DefaultShape = new RigidBodyTemplate(11, 1129.1553811562187f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }
        static void InitShape()
        {
            Coefficients        DefaultCoefficients = TimeWarp.Coefficients;
            List <IGeometry2D>  goes = new List <IGeometry2D>();
            List <Coefficients> coes = new List <Coefficients>();

            Vector2D[] pods      = Polygon2D.FromRectangle(20, 70);
            Vector2D[] mainhullp = Polygon2D.FromRectangle(30, 140);
            Vector2D[] subhullp  = Polygon2D.FromRectangle(40, 20);

            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI + .7f, new Vector2D(-35, 22)), subhullp));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI - .7f, new Vector2D(-35, -22)), subhullp));
            coes.Add(DefaultCoefficients);



            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(-50, 35)), pods));
            coes.Add(DefaultCoefficients);
            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(-50, -35)), pods));
            coes.Add(DefaultCoefficients);



            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(95, 0)), Polygon2D.FromNumberofSidesAndRadius(4, 25)));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(15f, 0)), mainhullp));
            coes.Add(DefaultCoefficients);



            goes.Add(new Polygon2D(new ALVector2D(MathHelper.PI, new Vector2D(30, 0)), Polygon2D.FromRectangle(80, 50)));
            coes.Add(DefaultCoefficients);

            goes.Add(new Polygon2D(new ALVector2D(0, new Vector2D(120, 0)), Polygon2D.FromRectangle(50, 50)));
            coes.Add(DefaultCoefficients);


            DefaultShape = new RigidBodyTemplate(18, 4077.711f, goes.ToArray(), coes.ToArray());
            DefaultShape.BalanceBody();

            //DefaultShape.CalcInertiaMultiplier(.1f);
        }
        static void InitShape()
        {
            Coefficients coe = TimeWarp.Coefficients;

            Vector2D[] bulletverticies = new Vector2D[]
            {
                new Vector2D(25, 0),
                new Vector2D(20, 10),
                new Vector2D(-20, 5),
                new Vector2D(-20, -5),
                new Vector2D(20, -10)
            };
            IGeometry2D enginecone = new Polygon2D(ALVector2D.Zero, bulletverticies);

            DefaultShape = new RigidBodyTemplate(.5f, 166.12352450641404f, new IGeometry2D[] { enginecone }, new Coefficients[] { coe });
            DefaultShape.BalanceBody();
            //////DefaultShape.CalcInertiaMultiplier(.1f);
        }