1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 23:50:29 +01:00

Added waypoint sphere on player while path creation menu is open if 3D waypoints are enabled.

This commit is contained in:
Rich Dunne 2020-08-27 15:57:59 -06:00
parent a103d9be67
commit 934e73d5c1
3 changed files with 33 additions and 5 deletions

View file

@ -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();
}
});
}
}
}

View file

@ -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<string> waypointType = new UIMenuListScrollerItem<string>("Waypoint Type", "", waypointTypes);
public static UIMenuListScrollerItem<string> waypointType = new UIMenuListScrollerItem<string>("Waypoint Type", "", waypointTypes);
private static UIMenuNumericScrollerItem<int> waypointSpeed;
private static UIMenuNumericScrollerItem<int> collectorRadius = new UIMenuNumericScrollerItem<int>("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<int> collectorRadius = new UIMenuNumericScrollerItem<int>("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()
{

View file

@ -46,6 +46,8 @@ namespace SceneManager
DebugGraphics.LoopToDrawDebugGraphics(debugGraphics, path);
});
}
DebugGraphics.DrawSphereOnPlayer(debugGraphics);
}
}