From 80a300789629682ab3fe51b61f13aaaadf817c1f Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Sat, 17 Oct 2020 07:08:42 -0600 Subject: [PATCH] Fixed a menu item spelling error. Fixed some menu items not resetting to default values when new path is started. Refactored for Waypoint object now handling vehicle collection --- SceneManager/Menus/PathCreationMenu.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/SceneManager/Menus/PathCreationMenu.cs b/SceneManager/Menus/PathCreationMenu.cs index a93f727..00eccc3 100644 --- a/SceneManager/Menus/PathCreationMenu.cs +++ b/SceneManager/Menus/PathCreationMenu.cs @@ -18,7 +18,7 @@ namespace SceneManager private static UIMenuNumericScrollerItem waypointSpeed; internal static UIMenuCheckboxItem stopWaypointType = new UIMenuCheckboxItem("Is this a Stop waypoint?", false, "If checked, vehicles will drive to this waypoint, then stop."); internal static UIMenuCheckboxItem directWaypointBehavior = new UIMenuCheckboxItem("Drive directly to waypoint?", false, "If checked, vehicles will ignore traffic rules and drive directly to this waypoint."); - internal static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If chcked, this waypoint will collect vehicles to follow the path. Your path's first waypoint ~b~must~w~ be a collector."); + internal static UIMenuCheckboxItem collectorWaypoint = new UIMenuCheckboxItem("Collector", true, "If checked, this waypoint will collect vehicles to follow the path. Your path's first waypoint ~b~must~w~ be a collector."); internal static UIMenuNumericScrollerItem collectorRadius = new UIMenuNumericScrollerItem("Collection Radius", "The distance from this waypoint (in meters) vehicles will be collected", 1, 50, 1); internal static UIMenuNumericScrollerItem speedZoneRadius = new UIMenuNumericScrollerItem("Speed Zone Radius", "The distance from this collector waypoint (in meters) non-collected vehicles will drive at this waypoint's speed", 5, 200, 5); @@ -107,6 +107,7 @@ namespace SceneManager ToggleTrafficEndPathMenuItem(pathIndex); collectorWaypoint.Enabled = true; + collectorWaypoint.Checked = false; trafficRemoveWaypoint.Enabled = true; PathMainMenu.createNewPath.Text = $"Continue Creating Path {pathNumber}"; @@ -206,21 +207,31 @@ namespace SceneManager currentPath.State = State.Finished; currentPath.IsEnabled = true; currentPath.Number = i + 1; + currentPath.LoopForVehiclesToBeDismissed(); - foreach (Waypoint waypoint in PathMainMenu.paths[i].Waypoints) + GameFiber.StartNew(() => { - GameFiber WaypointVehicleCollectorFiber = new GameFiber(() => VehicleCollector.StartCollectingAtWaypoint(PathMainMenu.paths, PathMainMenu.paths[i], waypoint)); - WaypointVehicleCollectorFiber.Start(); - } + foreach(Waypoint waypoint in PathMainMenu.paths[i].Waypoints) + { + GameFiber WaypointVehicleCollectorFiber = new GameFiber(() => waypoint.CollectVehicles(PathMainMenu.paths)); + WaypointVehicleCollectorFiber.Start(); + GameFiber.Sleep(1000); + } + }); PathMainMenu.createNewPath.Text = "Create New Path"; PathMainMenu.BuildPathMenu(); PathMainMenu.pathMainMenu.RefreshIndex(); pathCreationMenu.RefreshIndex(); + waypointSpeed.Index = 0; collectorWaypoint.Enabled = false; collectorWaypoint.Checked = true; speedZoneRadius.Enabled = true; + speedZoneRadius.Index = 0; collectorRadius.Enabled = true; + collectorRadius.Index = 0; + stopWaypointType.Checked = false; + directWaypointBehavior.Checked = false; trafficEndPath.Enabled = false; PathMainMenu.pathMainMenu.Visible = true;