virtual public void DrawPath(UCL.Core.MathLib.UCL_Path _Path, RectTransform field, Color col, VectorExtensionMethods.Vec3ToVec2 dir = VectorExtensionMethods.Vec3ToVec2.xy, int seg_count = 20) { Vector3[] Corners = new Vector3[4]; field.GetWorldCorners(Corners); Vector2 Min = Corners[0]; Vector2 Max = Corners[2]; for (int i = 0; i < 4; i++) { var point = Corners[i]; if (point.x < Min.x) { Min.x = point.x; } if (point.x > Max.x) { Max.x = point.x; } if (point.y < Min.y) { Min.y = point.y; } if (point.y > Max.y) { Max.y = point.y; } } DrawPath(_Path, Min, Max - Min, col, dir, seg_count); }
virtual public void DrawPath(UCL.Core.MathLib.UCL_Path _Path, Vector2 start_pos, Vector2 size, Color col, VectorExtensionMethods.Vec3ToVec2 dir = VectorExtensionMethods.Vec3ToVec2.xy, int seg_count = 20) { if (seg_count < 1) { seg_count = 1; } Vector2 prev_pos = _Path.GetPos(0).ToVec2(dir); for (int i = 1; i <= seg_count; i++) { float at = (i / (float)seg_count); Vector2 pos = _Path.GetPos(at).ToVec2(dir); DrawLine((prev_pos.x - start_pos.x) / size.x, (prev_pos.y - start_pos.y) / size.y, (pos.x - start_pos.x) / size.x, (pos.y - start_pos.y) / size.y, col); prev_pos = pos; } }
virtual public void DrawPath(UCL.Core.MathLib.UCL_Path _Path, Rect rect, Color col, VectorExtensionMethods.Vec3ToVec2 dir = VectorExtensionMethods.Vec3ToVec2.xy, int seg_count = 20) { DrawPath(_Path, rect.min, rect.size, col, dir, seg_count); }