|
|
|
|
@ -54,31 +54,49 @@ namespace Game
|
|
|
|
|
{
|
|
|
|
|
var posReal = pos + shape.Offset;
|
|
|
|
|
var posRealTop = posReal + Vector3.up * shape.Height;
|
|
|
|
|
var posRealMid = posReal + Vector3.up * (shape.Height / 2);
|
|
|
|
|
switch (shape.Type)
|
|
|
|
|
{
|
|
|
|
|
case EShapeType.Dot:
|
|
|
|
|
Debug.DrawLine(posReal + Vector3.left, posReal + Vector3.right, color);
|
|
|
|
|
Debug.DrawLine(posReal + Vector3.down, posReal + Vector3.up, color);
|
|
|
|
|
Debug.DrawLine(posReal + Vector3.back, posReal + Vector3.forward, color);
|
|
|
|
|
DrawShapeCross(posReal, 1, color);
|
|
|
|
|
DrawShapeCenter(posReal, 1, color);
|
|
|
|
|
break;
|
|
|
|
|
case EShapeType.Box:
|
|
|
|
|
DrawShapeBody(shape, pos, direction, color);
|
|
|
|
|
break;
|
|
|
|
|
case EShapeType.Sector:
|
|
|
|
|
DrawShapeBody(shape, pos, direction, color);
|
|
|
|
|
break;
|
|
|
|
|
case EShapeType.Circle:
|
|
|
|
|
DrawShapeBody(shape, pos, direction, color);
|
|
|
|
|
DrawShapeCenter(posRealMid, shape.Height / 2, color);
|
|
|
|
|
DrawShapeCross(posReal, shape.Radius, color);
|
|
|
|
|
DrawShapeCross(posRealTop, shape.Radius, color);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void DrawShapeCenter(Vector3 pos, float h, Color color)
|
|
|
|
|
{
|
|
|
|
|
Debug.DrawLine(pos + Vector3.down * h, pos + Vector3.up * h, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void DrawShapeCross(Vector3 pos, float r, Color color)
|
|
|
|
|
{
|
|
|
|
|
Debug.DrawLine(pos + Vector3.left * r, pos + Vector3.right * r, color);
|
|
|
|
|
Debug.DrawLine(pos + Vector3.back * r, pos + Vector3.forward * r, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void DrawShapeBody(Shape shape, Vector3 pos, Vector3 direction, Color color)
|
|
|
|
|
{
|
|
|
|
|
var posReal = pos + shape.Offset;
|
|
|
|
|
var posRealTop = posReal + Vector3.up * shape.Height;
|
|
|
|
|
shape.ForeachVerticesPair(direction, (v1, v2) =>
|
|
|
|
|
{
|
|
|
|
|
Debug.DrawLine(posReal + v1, posReal + v2, color);
|
|
|
|
|
Debug.DrawLine(posRealTop + v1, posRealTop + v2, color);
|
|
|
|
|
});
|
|
|
|
|
shape.ForeachVertices(direction, v => { Debug.DrawLine(posReal + v, posRealTop + v, color); });
|
|
|
|
|
break;
|
|
|
|
|
case EShapeType.Circle:
|
|
|
|
|
var r = shape.Radius;
|
|
|
|
|
var h = shape.Height;
|
|
|
|
|
Debug.DrawLine(posReal + Vector3.left * r, posReal + Vector3.right * r, color);
|
|
|
|
|
Debug.DrawLine(posReal + Vector3.back * r, posReal + Vector3.forward * r, color);
|
|
|
|
|
Debug.DrawLine(posRealTop + Vector3.left * r, posRealTop + Vector3.right * r, color);
|
|
|
|
|
Debug.DrawLine(posRealTop + Vector3.back * r, posRealTop + Vector3.forward * r, color);
|
|
|
|
|
Debug.DrawLine(posReal, posRealTop, color);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void Print(params object[] values)
|
|
|
|
|
|