1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 07:30:40 +01:00

Extracted debug graphics code to it's own class

This commit is contained in:
Rich Dunne 2020-08-20 15:32:02 -06:00
parent 0dc3b19bc2
commit eeb0d9de13

View file

@ -2,7 +2,6 @@
using RAGENativeUI;
using RAGENativeUI.Elements;
using System.Drawing;
using System.Linq;
namespace SceneManager
{
@ -37,53 +36,13 @@ namespace SceneManager
{
GameFiber.StartNew(() =>
{
while (debugGraphics.Checked && path != null && path.Waypoint.Count > 0)
{
for (int i = 0; i < path.Waypoint.Count; i++)
{
DrawSpheresAtWaypoints(path, i);
if (i != path.Waypoint.Count - 1)
{
DrawLinesBetweenWaypoints(path, i);
}
}
GameFiber.Yield();
}
DebugGraphics.LoopToDrawDebugGraphics(debugGraphics, path);
});
}
}
}
}
private static void DrawLinesBetweenWaypoints(Path path, int i)
{
if (path.Waypoint[i+1].DrivingFlag == VehicleDrivingFlags.StopAtDestination)
{
Debug.DrawLine(path.Waypoint[i].WaypointPos, path.Waypoint[i + 1].WaypointPos, Color.Orange);
}
else
{
Debug.DrawLine(path.Waypoint[i].WaypointPos, path.Waypoint[i + 1].WaypointPos, Color.Green);
}
}
private static void DrawSpheresAtWaypoints(Path path, int i)
{
if (path.Waypoint[i].Collector)
{
Debug.DrawSphere(path.Waypoint[i].WaypointPos, path.Waypoint[i].CollectorRadius, Color.FromArgb(80, Color.Blue));
}
else if (path.Waypoint[i].DrivingFlag == VehicleDrivingFlags.StopAtDestination)
{
Debug.DrawSphere(path.Waypoint[i].WaypointPos, 1f, Color.FromArgb(80, Color.Red));
}
else
{
Debug.DrawSphere(path.Waypoint[i].WaypointPos, 1f, Color.FromArgb(80, Color.Green));
}
}
private static void SettingsMenu_OnScrollerChange(UIMenu sender, UIMenuScrollerItem scrollerItem, int oldIndex, int newIndex)
{
if (scrollerItem == speedUnits)