/// <summary>
        /// Assemble the body for the given entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="args">The assembler args.</param>
        public void AssembleBody(Entity entity, HumanoidAssemblerArgs args)
        {
            // Randomise the sprite variations
            int clothesVariation = this.world.Resources.GetRandomSpriteVariation("body", "torso", args.SpriteFamily);
            int headVariation = this.world.Resources.GetRandomSpriteVariation("body", "head", args.SpriteFamily);
            int beardVariation = this.world.Resources.GetRandomSpriteVariation("body", "beard", args.SpriteFamily);

            // Create the body parts
            BodyPartInfo torso = this.AssembleBodyPart(
                entity,
                BodyPart.Torso,
                "torso",
                args.SpriteFamily,
                args.BodyPosition + args.TorsoPosition,
                args.CollisionGroup,
                clothesVariation);
            BodyPartInfo head = this.AssembleBodyPart(
                entity,
                BodyPart.Head,
                "head",
                args.SpriteFamily,
                args.BodyPosition + args.HeadPosition,
                args.CollisionGroup,
                clothesVariation);
            BodyPartInfo leftArm = this.AssembleBodyPart(
                entity,
                BodyPart.Arm,
                "arm",
                args.SpriteFamily,
                args.BodyPosition + args.ArmPosition,
                args.CollisionGroup,
                clothesVariation);
            BodyPartInfo rightArm = this.AssembleBodyPart(
                entity,
                BodyPart.Arm,
                "arm",
                args.SpriteFamily,
                args.BodyPosition + args.ArmPosition + args.LeftToRightOffset,
                args.CollisionGroup,
                clothesVariation);
            BodyPartInfo leftLeg = this.AssembleBodyPart(
                entity,
                BodyPart.Leg,
                "leg",
                args.SpriteFamily,
                args.BodyPosition + args.LegPosition,
                args.CollisionGroup);
            BodyPartInfo rightLeg = this.AssembleBodyPart(
                entity,
                BodyPart.Leg,
                "leg",
                args.SpriteFamily,
                args.BodyPosition + args.LegPosition + args.LeftToRightOffset,
                args.CollisionGroup);
            BodyPartInfo beard = this.AssembleBodyPart(
                entity,
                BodyPart.Beard,
                "beard",
                args.SpriteFamily,
                args.BodyPosition + args.BeardPosition,
                args.CollisionGroup,
                beardVariation,
                false);

            // Create the joints
            this.CreateFixedJoint(head, beard);
            this.CreateRotationalJoint(
                torso,
                head,
                args.NeckJointPosition.Position - args.HeadPosition,
                args.NeckJointPosition.EnableLimit,
                args.NeckJointPosition.UpperLimit,
                args.NeckJointPosition.LowerLimit,
                args.NeckJointPosition.EnableMotor,
                args.NeckJointPosition.MaxMotorTorque);
            this.CreateRotationalJoint(
                torso,
                leftArm,
                args.ShoulderJointPosition.Position - args.ArmPosition,
                args.NeckJointPosition.EnableLimit,
                args.NeckJointPosition.UpperLimit,
                args.NeckJointPosition.LowerLimit,
                args.NeckJointPosition.EnableMotor,
                args.NeckJointPosition.MaxMotorTorque);
            this.CreateRotationalJoint(
                torso,
                rightArm,
                args.ShoulderJointPosition.Position - args.ArmPosition,
                args.NeckJointPosition.EnableLimit,
                args.NeckJointPosition.UpperLimit,
                args.NeckJointPosition.LowerLimit,
                args.NeckJointPosition.EnableMotor,
                args.NeckJointPosition.MaxMotorTorque);
            this.CreateRotationalJoint(
                torso,
                leftLeg,
                args.HipJointPosition.Position - args.LegPosition,
                args.NeckJointPosition.EnableLimit,
                args.NeckJointPosition.UpperLimit,
                args.NeckJointPosition.LowerLimit,
                args.NeckJointPosition.EnableMotor,
                args.NeckJointPosition.MaxMotorTorque);
            this.CreateRotationalJoint(
                torso,
                rightLeg,
                args.HipJointPosition.Position - args.LegPosition,
                args.NeckJointPosition.EnableLimit,
                args.NeckJointPosition.UpperLimit,
                args.NeckJointPosition.LowerLimit,
                args.NeckJointPosition.EnableMotor,
                args.NeckJointPosition.MaxMotorTorque);
        }
        /// <summary>
        /// Create a dwarf entity.
        /// </summary>
        /// <param name="world">The world context.</param>
        /// <param name="x">The x position.</param>
        /// <param name="y">The y position.</param>
        /// <returns>The entity.</returns>
        public Entity CreateDwarf(WorldContext world, float x, float y)
        {
            Entity entity = world.EntityManager.CreateEntity();

            // Prepare the args for the humanoid assembler
            var neckJoint = new HumanoidAssemblerArgs.RevoluteJoint(
                new Vector2(0, 11) * Const.PixelsToMeters,
                true,
                -MathHelper.Pi / 4,
                MathHelper.Pi / 4,
                false,
                0);
            var shoulderJoint = new HumanoidAssemblerArgs.RevoluteJoint(
                new Vector2(-2.5f, 8) * Const.PixelsToMeters,
                true,
                -MathHelper.Pi / 4,
                MathHelper.Pi / 4,
                false,
                0);
            var hipJoint = new HumanoidAssemblerArgs.RevoluteJoint(
                new Vector2(-2, 3) * Const.PixelsToMeters,
                true,
                -MathHelper.Pi / 4,
                MathHelper.Pi / 4,
                false,
                0);
            var args = new HumanoidAssemblerArgs(
                "dwarf",
                Const.CollisionGroupDwarf,
                new Vector2(x, y),                                  // Body position
                new Vector2(4, 0) * Const.PixelsToMeters,    // Right-left offset
                new Vector2(-5, 11) * Const.PixelsToMeters,  // Torso
                new Vector2(-2, 19) * Const.PixelsToMeters,  // Head
                new Vector2(-3, 9) * Const.PixelsToMeters,   // Arm
                new Vector2(-2, 3) * Const.PixelsToMeters,   // Leg
                new Vector2(-3, 20) * Const.PixelsToMeters,  // Beard
                neckJoint,                                          // Neck joint
                shoulderJoint,                                      // Shoulder joint
                hipJoint);                                          // Hip joint

            // Assemble the body
            var bodyAssembler = new HumanoidAssembler(world);
            bodyAssembler.AssembleBody(entity, args);

            return entity;
        }