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); } }
void IDebugDrawer.Draw(Vec2 center, float radius, params object[] data) { Primitives2D.DrawCircle(Vec2.Zero.ToVector2(), radius, colors[(int)data[0] % colors.Length]); }