Exemplo n.º 1
0
        /// <summary>
        /// Construct a new Pole.
        /// </summary>
        public Four(World world)
            : base(world)
        {
            // Carbon Radius
            this.radius = 120.0f * world.ResVar;
            // Collision Radius (Radius * 1000)
            this.collisionRadius = this.radius * 0.5f;
            // Carbon Color
            this.color = Color.Green;
            // create the polygon
            this.polygon = VectorPolygon.CreateCircle(Vector2.Zero, radius, 100);
            // the atom polygon might not be as big as the original radius,
            // so find out how big it really is
            for (int i = 0; i < this.polygon.Points.Length; i++)
            {
                float length = this.polygon.Points[i].Length();
                if (length > this.radius)
                {
                    this.radius = length;
                }
            }
            // calculate the mass
            this.mass = radius * massRadiusRatio;

            // Mass
            this.mass = 10000000f;
            // Velocity
            this.velocity = Vector2.Zero;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Construct a new oxygen.
 /// </summary>
 /// <param name="world">The world that this oxygen belongs to.</param>
 /// <param name="radius">The size of the oxygen.</param>
 public Hydroxyl(World world)
     : base(world)
 {
     // Oxygen Radius
     this.radius = 16f * world.ResVar; //2*(15.9994);
     // Collision Radius (Radius * 10)
     this.collisionRadius = this.radius * 10;
     // all atoms are coloured according to which type they are
     this.color = Color.Red;
     // create the polygon
     this.polygon         = VectorPolygon.CreateCircle(Vector2.Zero, radius, 100);
     this.hydrogenPolygon = VectorPolygon.CreateCircle(new Vector2(22f * world.ResVar, 0), 4f * world.ResVar, 100);
     // the atom polygon might not be as big as the original radius,
     // so find out how big it really is
     for (int i = 0; i < this.polygon.Points.Length; i++)
     {
         float length = this.polygon.Points[i].Length();
         if (length > this.radius)
         {
             this.radius = length;
         }
     }
     // calculate the mass
     this.mass = radius * massRadiusRatio;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Construct a new oxygen.
 /// </summary>
 /// <param name="world">The world that this oxygen belongs to.</param>
 /// <param name="radius">The size of the oxygen.</param>
 public CFC1(World world)
     : base(world)
 {
     // Carbon Radius
     this.radius = 25.0f * world.ResVar; //(12.0107);
     // Collision Radius (Radius * 10)
     this.collisionRadius = this.radius * 8f;
     // Carbon Color
     this.color = Color.Gray;
     // create the polygon
     this.polygon          = VectorPolygon.CreateCircle(Vector2.Zero, 12f * world.ResVar, 100);
     this.chlorine1Polygon = VectorPolygon.CreateCircle(new Vector2(-50f * world.ResVar, -2f * world.ResVar), 35.5f * world.ResVar, 100);
     this.chlorine2Polygon = VectorPolygon.CreateCircle(new Vector2(2f * world.ResVar, -50f * world.ResVar), 35.5f * world.ResVar, 100);
     this.fluorine1Polygon = VectorPolygon.CreateCircle(new Vector2(33.5f * world.ResVar, 0), 19f * world.ResVar, 100);
     this.fluorine2Polygon = VectorPolygon.CreateCircle(new Vector2(0, 33.5f * world.ResVar), 19f * world.ResVar, 100);
     // the atom polygon might not be as big as the original radius,
     // so find out how big it really is
     for (int i = 0; i < this.polygon.Points.Length; i++)
     {
         float length = this.polygon.Points[i].Length();
         if (length > this.radius)
         {
             this.radius = length;
         }
     }
     // calculate the mass
     this.mass = radius * massRadiusRatio;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Construct a new oxygen.
 /// </summary>
 /// <param name="world">The world that this oxygen belongs to.</param>
 /// <param name="radius">The size of the oxygen.</param>
 public Methylene(World world)
     : base(world)
 {
     // Carbon Radius
     this.radius = 12.0f * world.ResVar; //(12.0107);
     // Collision Radius (Radius * 10)
     this.collisionRadius = this.radius * 10;
     // Carbon Color
     this.color = Color.Gray;
     // create the polygon
     this.polygon = VectorPolygon.CreateCircle(Vector2.Zero, radius, 100);
     // create the polygon
     this.hydrogen1Polygon = VectorPolygon.CreateCircle(new Vector2(-18f * world.ResVar, 0), 4f * world.ResVar, 100);
     this.hydrogen2Polygon = VectorPolygon.CreateCircle(new Vector2(18f * world.ResVar, 0), 4f * world.ResVar, 100);
     // the atom polygon might not be as big as the original radius,
     // so find out how big it really is
     for (int i = 0; i < this.polygon.Points.Length; i++)
     {
         float length = this.polygon.Points[i].Length();
         if (length > this.radius)
         {
             this.radius = length;
         }
     }
     // calculate the mass
     this.mass = radius * massRadiusRatio;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Draws the given polygon.
        /// </summary>
        /// <param name="polygon">The polygon to render.</param>
        /// <param name="color">The color to use when drawing the polygon.</param>
        /// <param name="dashed">If true, the polygon will be "dashed".</param>
        public void DrawPolygon(VectorPolygon polygon, Color color, bool dashed)
        {
            if (polygon == null)
            {
                throw new ArgumentNullException("polygon");
            }
            int step = (dashed == true) ? 2 : 1;

            for (int i = 0; i < polygon.TransformedPoints.Length; i += step)
            {
                if (currentIndex >= vertices.Length - 2)
                {
                    End();
                    Begin();
                }
                vertices[currentIndex].Position.X =
                    polygon.TransformedPoints[i % polygon.TransformedPoints.Length].X;
                vertices[currentIndex].Position.Y =
                    polygon.TransformedPoints[i % polygon.TransformedPoints.Length].Y;
                vertices[currentIndex++].Color    = color;
                vertices[currentIndex].Position.X =
                    polygon.TransformedPoints[(i + 1) %
                                              polygon.TransformedPoints.Length].X;
                vertices[currentIndex].Position.Y =
                    polygon.TransformedPoints[(i + 1) %
                                              polygon.TransformedPoints.Length].Y;
                vertices[currentIndex++].Color = color;
                lineCount++;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Constructs a new rocket projectile.
 /// </summary>
 /// <param name="world">The world that this projectile belongs to.</param>
 /// <param name="owner">The ship that fired this projectile, if any.</param>
 /// <param name="direction">The initial direction for this projectile.</param>
 public AtomicMoleBlastProjectile(World world, NanoBot owner, Vector2 direction)
     : base(world, owner, direction)
 {
     this.radius       = 4f * world.ResVar;
     this.life         = 0.65f * world.ResVar;
     this.duration     = 0.65f * world.ResVar;
     this.mass         = 4f;
     this.speed        = 500f;
     this.damageAmount = 50f;
     this.damageOwner  = false;
     this.damageRadius = 16f;
     this.explodes     = true;
     this.polygon      = VectorPolygon.CreateCircle(Vector2.Zero, 4f * world.ResVar, 20);
     this.color        = Color.Gray;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Construct a new oxygen.
 /// </summary>
 /// <param name="world">The world that this oxygen belongs to.</param>
 /// <param name="radius">The size of the oxygen.</param>
 public Nitrogen(World world)
     : base(world)
 {
     // Nitrogen Radius
     this.radius = 14.0f * world.ResVar; //(14.00674);
     // all atoms are coloured according to which type they are
     this.color = Color.Blue;
     // create the polygon
     this.polygon = VectorPolygon.CreateCircle(Vector2.Zero, radius, 100);
     // the atom polygon might not be as big as the original radius,
     // so find out how big it really is
     for (int i = 0; i < this.polygon.Points.Length; i++)
     {
         float length = this.polygon.Points[i].Length();
         if (length > this.radius)
         {
             this.radius = length;
         }
     }
     // calculate the mass
     this.mass = radius * massRadiusRatio;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Construct a new oxygen.
 /// </summary>
 /// <param name="world">The world that this oxygen belongs to.</param>
 /// <param name="radius">The size of the oxygen.</param>
 public Chlorine(World world)
     : base(world)
 {
     // Chlorine Radius
     this.radius = 35.5f * world.ResVar; //(35.453);
     // Collision Radius (Radius * 10)
     this.collisionRadius = this.radius * 10;
     // all atoms are coloured according to which type they are
     this.color = Color.Green;
     // create the polygon
     this.polygon = VectorPolygon.CreateCircle(Vector2.Zero, radius, 100);
     // the atom polygon might not be as big as the original radius,
     // so find out how big it really is
     for (int i = 0; i < this.polygon.Points.Length; i++)
     {
         float length = this.polygon.Points[i].Length();
         if (length > this.radius)
         {
             this.radius = length;
         }
     }
     // calculate the mass
     this.mass = radius * massRadiusRatio;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Draws the given polygon.
 /// </summary>
 /// <param name="polygon">The polygon to render.</param>
 /// <param name="color">The color to use when drawing the polygon.</param>
 public void DrawPolygon(VectorPolygon polygon, Color color)
 {
     DrawPolygon(polygon, color, false);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructs a new power-up.
 /// </summary>
 /// <param name="world">The world that this power-up belongs to.</param>
 public PowerUp(World world) : base(world)
 {
     this.mass         = 500f;
     this.polygon      = VectorPolygon.CreateCircle(Vector2.Zero, 16f, 16);
     this.innerPolygon = VectorPolygon.CreateCircle(Vector2.Zero, 10f, 16);
 }