Ejemplo n.º 1
0
        protected static void DrawShape(Shape shape, Vec2 position, Color color)
        {
            if (shape is Polygon)
            {
                Polygon polygon = shape as Polygon;
                Vec2[]  verts   = new Vec2[polygon.VertexCount];

                for (int i = 0; i < polygon.VertexCount; i++)
                {
                    verts[i] = polygon.transform.localToWorldRotation * polygon.vertices[i];
                }

                Primitives2D.DrawPolygon(position.ToVector2(), Array.ConvertAll(verts, v => v.ToVector2()), color);
            }
            else if (shape is Circle)
            {
                Circle circle = shape as Circle;
                Primitives2D.DrawCircle(position.ToVector2(), circle.radius, color);
            }
        }
Ejemplo n.º 2
0
 void IDebugDrawer.Draw(Vec2[] vertices, params object[] data)
 {
     Primitives2D.DrawPolygon(Vec2.Zero.ToVector2(), Array.ConvertAll(vertices, v => v.ToVector2()), colors[(int)data[0] % colors.Length]);
 }