Exemplo n.º 1
0
 public void Add(BodyEx body)
 {
     if (OnBodyAdded != null)
         OnBodyAdded(this, body.Body);
     Bodies.Add(body);
     ChangeDimension(dim0);
 }
Exemplo n.º 2
0
 public void Copy(Body body, Vector2 position)
 {
     BodyEx b = FindBody(body);
     Body copy;
     if (b.Shape == DisplayShape.Box)
     {
         copy = BodyFactory.CreateRectangle(world, b.Dimension.X, b.Dimension.Y, b.Body.Mass, b.Shape.ToString().ToLower() + ";" + b.Dimension.X + ";" + b.Dimension.Y + ";" + b.GameDimension.ToString() + ";copy");
     }
     else if (b.Shape == DisplayShape.Circle)
     {
         copy = BodyFactory.CreateCircle(world, b.Length, b.Body.Mass, b.Shape.ToString().ToLower() + ";" + b.Dimension.X + ";" + b.Dimension.Y + ";" + b.GameDimension.ToString() + ";copy");
     }
     else
     {
         copy = BodyFactory.CreateCapsule(world, b.Dimension.X, b.Dimension.Y, b.Body.Mass, b.Shape.ToString().ToLower() + ";" + b.Dimension.X + ";" + b.Dimension.Y + ";" + b.GameDimension.ToString() + ";copy");
     }
     copy.BodyType = body.BodyType;
     copy.Friction = body.Friction;
     copy.Restitution = body.Restitution;
     copy.Rotation = body.Rotation;
     copy.Position = position;
     copy.IsBullet = body.IsBullet;
     BodyEx c = new BodyEx(copy);
     c.Tex = b.Tex;
     c.TexRect = b.TexRect;
     c.TexPath = b.TexPath;
     Add(c);
 }