mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-11 01:13:47 +00:00
Clean up Gizmos.cs
This commit is contained in:
parent
fedf89e045
commit
8e9517e739
@ -125,33 +125,40 @@ namespace Popcron
|
||||
}
|
||||
}
|
||||
|
||||
public static void Lines(Vector3[] lines, Color? color = null, bool dashed = false) => GizmosInstance.Submit(lines, color, dashed);
|
||||
public static void Lines(Vector3[] lines, Color? color = null, bool dashed = false)
|
||||
=> GizmosInstance.Submit(lines, color, dashed);
|
||||
|
||||
public static void Line(Vector3 a, Vector3 b, Color? color = null, bool dashed = false) => Draw<LineDrawer>(color, dashed, a, b);
|
||||
public static void Line(Vector3 a, Vector3 b, Color? color = null, bool dashed = false)
|
||||
=> Draw<LineDrawer>(color, dashed, a, b);
|
||||
|
||||
public static void Square(Vector2 position, Vector2 size, Color? color = null, bool dashed = false) => Square(position, Quaternion.identity, size, color, dashed);
|
||||
public static void Square(Vector2 position, Vector2 size, Color? color = null, bool dashed = false)
|
||||
=> Square(position, Quaternion.identity, size, color, dashed);
|
||||
|
||||
public static void Square(Vector2 position, float diameter, Color? color = null, bool dashed = false) => Square(position, Quaternion.identity, Vector2.one * diameter, color, dashed);
|
||||
public static void Square(Vector2 position, float diameter, Color? color = null, bool dashed = false)
|
||||
=> Square(position, Quaternion.identity, Vector2.one * diameter, color, dashed);
|
||||
|
||||
public static void Square(Vector2 position, Quaternion rotation, Vector2 size, Color? color = null, bool dashed = false) => Draw<SquareDrawer>(color, dashed, position, rotation, size);
|
||||
public static void Square(Vector2 position, Quaternion rotation, Vector2 size, Color? color = null, bool dashed = false)
|
||||
=> Draw<SquareDrawer>(color, dashed, position, rotation, size);
|
||||
|
||||
public static void Cube(Vector3 position, Quaternion rotation, Vector3 size, Color? color = null, bool dashed = false) => Draw<CubeDrawer>(color, dashed, position, rotation, size);
|
||||
public static void Cube(Vector3 position, Quaternion rotation, Vector3 size, Color? color = null, bool dashed = false)
|
||||
=> Draw<CubeDrawer>(color, dashed, position, rotation, size);
|
||||
|
||||
public static void Rect(Rect rect, Camera camera, Color? color = null, bool dashed = false)
|
||||
{
|
||||
rect.y = Screen.height - rect.y;
|
||||
Vector2 corner = camera.ScreenToWorldPoint(new Vector2(rect.x, rect.y - rect.height));
|
||||
Draw<SquareDrawer>(color, dashed, corner + rect.size * 0.5f, Quaternion.identity, rect.size);
|
||||
Draw<SquareDrawer>(color, dashed, corner + (rect.size * 0.5f), Quaternion.identity, rect.size);
|
||||
}
|
||||
|
||||
public static void Bounds(Bounds bounds, Color? color = null, bool dashed = false) => Draw<CubeDrawer>(color, dashed, bounds.center, Quaternion.identity, bounds.size);
|
||||
public static void Bounds(Bounds bounds, Color? color = null, bool dashed = false)
|
||||
=> Draw<CubeDrawer>(color, dashed, bounds.center, Quaternion.identity, bounds.size);
|
||||
|
||||
public static void Cone(Vector3 position, Quaternion rotation, float length, float angle, Color? color = null, bool dashed = false, int pointsCount = 16)
|
||||
{
|
||||
//draw the end of the cone
|
||||
var endAngle = Mathf.Tan(angle * 0.5f * Mathf.Deg2Rad) * length;
|
||||
var forward = rotation * Vector3.forward;
|
||||
var endPosition = position + forward * length;
|
||||
var endPosition = position + (forward * length);
|
||||
var offset = 0f;
|
||||
Draw<PolygonDrawer>(color, dashed, endPosition, pointsCount, endAngle, offset, rotation);
|
||||
|
||||
@ -160,7 +167,7 @@ namespace Popcron
|
||||
{
|
||||
var a = i * 90f * Mathf.Deg2Rad;
|
||||
var point = rotation * new Vector3(Mathf.Cos(a), Mathf.Sin(a)) * endAngle;
|
||||
Line(position, position + point + forward * length, color, dashed);
|
||||
Line(position, position + point + (forward * length), color, dashed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,6 +192,7 @@ namespace Popcron
|
||||
Draw<PolygonDrawer>(color, dashed, position, pointsCount, radius, offset, rotation);
|
||||
}
|
||||
|
||||
public static void Frustum(OWCamera camera, Color? color = null, bool dashed = false) => Draw<FrustumDrawer>(color, dashed, camera);
|
||||
public static void Frustum(OWCamera camera, Color? color = null, bool dashed = false)
|
||||
=> Draw<FrustumDrawer>(color, dashed, camera);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user