Example #1
0
        public void DrawRider(float opacity, Rider rider, bool scarf = false)
        {
            if (scarf)
            {
                DrawScarf(rider.GetScarfLines(), opacity);
            }
            var points = rider.Body;

            DrawTexture(
                Tex.Leg,
                Models.LegRect,
                Models.LegUV,
                points[RiderConstants.BodyButt].Location,
                points[RiderConstants.BodyFootRight].Location,
                opacity);

            DrawTexture(
                Tex.Arm,
                Models.ArmRect,
                Models.ArmUV,
                points[RiderConstants.BodyShoulder].Location,
                points[RiderConstants.BodyHandRight].Location,
                opacity);
            if (!rider.Crashed)
            {
                DrawLine(
                    points[RiderConstants.BodyHandRight].Location,
                    points[RiderConstants.SledTR].Location,
                    ChangeOpacity(Color.Black, opacity),
                    0.1f);
            }

            if (rider.SledBroken)
            {
                var nose = points[RiderConstants.SledTR].Location - points[RiderConstants.SledTL].Location;
                var tail = points[RiderConstants.SledBL].Location - points[RiderConstants.SledTL].Location;
                if ((nose.X * tail.Y) - (nose.Y * tail.X) < 0)
                {
                    var olduv = Models.BrokenSledUV;
                    //we're upside down
                    DrawTexture(
                        Tex.BrokenSled,
                        Models.BrokenSledRect,
                        FloatRect.FromLRTB(
                            olduv.Left,
                            olduv.Right,
                            olduv.Bottom,
                            olduv.Top),
                        points[RiderConstants.SledBL].Location,
                        points[RiderConstants.SledBR].Location, opacity);
                }
                else
                {
                    DrawTexture(
                        Tex.BrokenSled,
                        Models.BrokenSledRect,
                        Models.BrokenSledUV,
                        points[RiderConstants.SledTL].Location,
                        points[RiderConstants.SledTR].Location,
                        opacity);
                }
            }
            else
            {
                DrawTexture(
                    Tex.Sled,
                    Models.SledRect,
                    Models.SledUV,
                    points[RiderConstants.SledTL].Location,
                    points[RiderConstants.SledTR].Location,
                    opacity);
            }

            DrawTexture(
                Tex.Leg,
                Models.LegRect,
                Models.LegUV,
                points[RiderConstants.BodyButt].Location,
                points[RiderConstants.BodyFootLeft].Location,
                opacity);
            if (!rider.Crashed)
            {
                DrawTexture(
                    Tex.Body,
                    Models.BodyRect,
                    Models.BodyUV,
                    points[RiderConstants.BodyButt].Location,
                    points[RiderConstants.BodyShoulder].Location,
                    opacity);
            }
            else
            {
                DrawTexture(
                    Tex.BodyDead,
                    Models.BodyRect,
                    Models.DeadBodyUV,
                    points[RiderConstants.BodyButt].Location,
                    points[RiderConstants.BodyShoulder].Location,
                    opacity);
            }
            if (!rider.Crashed)
            {
                DrawLine(
                    points[RiderConstants.BodyHandLeft].Location,
                    points[RiderConstants.SledTR].Location,
                    ChangeOpacity(Color.Black, opacity),
                    0.1f);
            }

            DrawTexture(
                Tex.Arm,
                Models.ArmRect,
                Models.ArmUV,
                points[RiderConstants.BodyShoulder].Location,
                points[RiderConstants.BodyHandLeft].Location,
                opacity);
        }