Example #1
0
        public void Draw(IGraphics g)
        {
            Color color = Colors.White;

            switch (_wallType)
            {
            case WallType.SIDE:
                color = new Color(0, 0.5, 0);
                break;

            case WallType.LEFTGOAL:
                color = new Color(1, 0, 0);
                break;

            case WallType.RIGHTGOAL:
                color = new Color(0, 0, 1);
                break;
            }

            g.CircleSegment(color, Position, Radius, _startAngle, _endAngle);
        }
Example #2
0
        public void Draw(IGraphics g, Color c, int i)
        {
            string tmp = "";

            Vector refpoint = Pixel.Position + 1 * Pixel.Normal;

            /* Body of the player */
            g.CircleSegment(c, refpoint, 2, Pixel.Alpha + Math.PI / 2, Pixel.Alpha - Math.PI / 2);
            g.CircleSegment(c, refpoint, 3, Pixel.Alpha - Math.PI / 2, Pixel.Alpha + Math.PI / 2);
            g.Line(c, refpoint + 3 * new Vector(-Pixel.Normal.Y, Pixel.Normal.X), Pixel.Position + 1 * Pixel.Normal + 3 * new Vector(Pixel.Normal.Y, -Pixel.Normal.X));

            /* Acitve Player is filled */
            if (this == Match.ActivePlayer)
            {
                g.CircleSegment(c, refpoint, 0.5, Pixel.Alpha + Math.PI / 2, Pixel.Alpha - Math.PI / 2);
                g.CircleSegment(c, refpoint, 1.0, Pixel.Alpha + Math.PI / 2, Pixel.Alpha - Math.PI / 2);
                g.CircleSegment(c, refpoint, 1.5, Pixel.Alpha + Math.PI / 2, Pixel.Alpha - Math.PI / 2);
                g.CircleSegment(c, refpoint, 2.5, Pixel.Alpha + Math.PI / 2, Pixel.Alpha - Math.PI / 2);
            }

            /* hitbox*//*
             * for (int j = 0; j < Hitbox.Length - 1; j++)
             * {
             *  g.Line(c, Hitbox[j], Hitbox[j + 1]);
             * }*/

            /* Gun */
            g.Line(c, refpoint + 3 * Pixel.Normal, refpoint + 3 * Pixel.Normal + 5 * new Vector(Math.Cos(Aiming), Math.Sin(Aiming)));

            /* crosshair*/
            if (this == Match.ActivePlayer)
            {
                var p = refpoint + 2 * Pixel.Normal + 15 * new Vector(Math.Cos(Aiming), Math.Sin(Aiming));
                g.Line(c, p - 1 * new Vector(Math.Cos(Aiming + Math.PI / 4), Math.Sin(Aiming + Math.PI / 4)), p + 1 * new Vector(Math.Cos(Aiming + Math.PI / 4), Math.Sin(Aiming + Math.PI / 4)));
                g.Line(c, p - 1 * new Vector(Math.Cos(Aiming - Math.PI / 4), Math.Sin(Aiming - Math.PI / 4)), p + 1 * new Vector(Math.Cos(Aiming - Math.PI / 4), Math.Sin(Aiming - Math.PI / 4)));
            }

            /* Name */
            tmp = ((i + Match.StartPlayerIdx) % Match.Players.Count + 1).ToString().ToUpper() + "." + Name;
            g.Print(c, 3, Pixel.Position + new Vector(-tmp.Length / 2 * 3, -18), tmp);

            /* Health */
            tmp = ((int)Health).ToString().ToUpper();
            g.Print(c, 3, Pixel.Position + new Vector(-tmp.Length / 2 * 3, -15), tmp);
        }
 /// <summary>
 /// Draws a circle.
 /// </summary>
 /// <param name="graphics">The graphics object.</param>
 /// <param name="color">The color.</param>
 /// <param name="center">The center point.</param>
 /// <param name="radius">The radius.</param>
 public static void Circle(this IGraphics graphics, Color color, Vector center, double radius)
 {
     graphics.CircleSegment(color, center, radius, 0, 2 * Math.PI);
 }