diff --git a/SceneManager/DebugGraphics.cs b/SceneManager/DebugGraphics.cs index 3eacd3b..88a910f 100644 --- a/SceneManager/DebugGraphics.cs +++ b/SceneManager/DebugGraphics.cs @@ -23,7 +23,7 @@ namespace SceneManager } } - public static void DrawLinesBetweenWaypoints(Path path, int i) + private static void DrawLinesBetweenWaypoints(Path path, int i) { if (path.Waypoints[i + 1].DrivingFlag == VehicleDrivingFlags.StopAtDestination) { @@ -35,7 +35,7 @@ namespace SceneManager } } - public static void DrawSpheresAtWaypoints(Path path, int i) + private static void DrawSpheresAtWaypoints(Path path, int i) { if (path.Waypoints[i].IsCollector) { @@ -50,5 +50,31 @@ namespace SceneManager Debug.DrawSphere(path.Waypoints[i].Position, 1f, Color.FromArgb(80, Color.Green)); } } + + public static void DrawSphereOnPlayer(UIMenuCheckboxItem debugGraphics) + { + GameFiber.StartNew(() => + { + while (debugGraphics.Checked) + { + if (PathCreationMenu.pathCreationMenu.Visible) + { + if (PathCreationMenu.collectorWaypoint.Checked) + { + Debug.DrawSphere(Game.LocalPlayer.Character.Position, PathCreationMenu.collectorRadius.Value, Color.FromArgb(80, Color.Blue)); + } + else if (PathCreationMenu.waypointType.SelectedItem == "Drive To") + { + Debug.DrawSphere(Game.LocalPlayer.Character.Position, PathCreationMenu.collectorRadius.Value, Color.FromArgb(80, Color.Green)); + } + else + { + Debug.DrawSphere(Game.LocalPlayer.Character.Position, PathCreationMenu.collectorRadius.Value, Color.FromArgb(80, Color.Red)); + } + } + GameFiber.Yield(); + } + }); + } } } diff --git a/SceneManager/Menus/PathCreationMenu.cs b/SceneManager/Menus/PathCreationMenu.cs index 245a6f7..244d889 100644 --- a/SceneManager/Menus/PathCreationMenu.cs +++ b/SceneManager/Menus/PathCreationMenu.cs @@ -14,10 +14,10 @@ namespace SceneManager private static string[] waypointTypes = new string[] { "Drive To", "Stop" }; public static UIMenu pathCreationMenu { get; private set; } private static UIMenuItem trafficAddWaypoint, trafficRemoveWaypoint, trafficEndPath; - private static UIMenuListScrollerItem waypointType = new UIMenuListScrollerItem("Waypoint Type", "", waypointTypes); + public static UIMenuListScrollerItem waypointType = new UIMenuListScrollerItem("Waypoint Type", "", waypointTypes); private static UIMenuNumericScrollerItem waypointSpeed; - private static UIMenuNumericScrollerItem collectorRadius = new UIMenuNumericScrollerItem("Collection Radius", "The distance from this waypoint in meters vehicles will be collected", 1, 50, 1); - private static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If this waypoint will collect vehicles to follow the path"); + public static UIMenuNumericScrollerItem collectorRadius = new UIMenuNumericScrollerItem("Collection Radius", "The distance from this waypoint in meters vehicles will be collected", 1, 50, 1); + public static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If this waypoint will collect vehicles to follow the path"); internal static void InstantiateMenu() { diff --git a/SceneManager/Menus/SettingsMenu.cs b/SceneManager/Menus/SettingsMenu.cs index 79fa423..7853cd4 100644 --- a/SceneManager/Menus/SettingsMenu.cs +++ b/SceneManager/Menus/SettingsMenu.cs @@ -46,6 +46,8 @@ namespace SceneManager DebugGraphics.LoopToDrawDebugGraphics(debugGraphics, path); }); } + + DebugGraphics.DrawSphereOnPlayer(debugGraphics); } }