From d8bf8992f0d3e64c5c732140eb836c1cbd3c9b59 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Thu, 20 Aug 2020 12:17:06 -0600 Subject: [PATCH] Changed sphere and line colors for debug graphics based on waypoint types --- SceneManager/Menus/SettingsMenu.cs | 43 +++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/SceneManager/Menus/SettingsMenu.cs b/SceneManager/Menus/SettingsMenu.cs index dbc4d91..9b3d438 100644 --- a/SceneManager/Menus/SettingsMenu.cs +++ b/SceneManager/Menus/SettingsMenu.cs @@ -41,22 +41,11 @@ namespace SceneManager { for (int i = 0; i < path.Waypoint.Count; 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)); - } + DrawSpheresAtWaypoints(path, i); if (i != path.Waypoint.Count - 1) { - Debug.DrawLine(path.Waypoint[i].WaypointPos, path.Waypoint[i + 1].WaypointPos, Color.White); + DrawLinesBetweenWaypoints(path, i); } } GameFiber.Yield(); @@ -67,6 +56,34 @@ namespace SceneManager } } + 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)