From c48d1ea8ed16c7e7a96df8815c1d605b0f6d1a5a Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Thu, 20 Aug 2020 08:47:28 -0600 Subject: [PATCH] Renamed ControlledVehicle object and class to CollectedVehicle --- SceneManager/Menus/TrafficMenu.cs | 4 ++-- ...{ControlledVehicle.cs => CollectedVehicle.cs} | 4 ++-- SceneManager/SceneManager.csproj | 2 +- SceneManager/TrafficPathing.cs | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) rename SceneManager/Object Classes/{ControlledVehicle.cs => CollectedVehicle.cs} (76%) diff --git a/SceneManager/Menus/TrafficMenu.cs b/SceneManager/Menus/TrafficMenu.cs index 15ca80f..395afaa 100644 --- a/SceneManager/Menus/TrafficMenu.cs +++ b/SceneManager/Menus/TrafficMenu.cs @@ -88,7 +88,7 @@ namespace SceneManager var pathVehicles = TrafficPathing.collectedVehicles.Where(cv => cv.Value.Path == path.PathNum).ToList(); Game.LogTrivial($"Removing all vehicles on the path"); - foreach (KeyValuePair cv in pathVehicles.Where(cv => cv.Value.Vehicle && cv.Value.Vehicle.Driver)) + foreach (KeyValuePair cv in pathVehicles.Where(cv => cv.Value.Vehicle && cv.Value.Vehicle.Driver)) { cv.Value.DismissNow = true; cv.Value.Vehicle.Driver.Tasks.Clear(); @@ -246,7 +246,7 @@ namespace SceneManager } else { - TrafficPathing.collectedVehicles.Add(nearbyVehicle.LicensePlate, new ControlledVehicle(nearbyVehicle, nearbyVehicle.LicensePlate, paths[directDriver.Index].Waypoint[0].Path, paths[directDriver.Index].Waypoint.Count, 1, false, false, true)); + TrafficPathing.collectedVehicles.Add(nearbyVehicle.LicensePlate, new CollectedVehicle(nearbyVehicle, nearbyVehicle.LicensePlate, paths[directDriver.Index].Waypoint[0].Path, paths[directDriver.Index].Waypoint.Count, 1, false, false, true)); Game.LogTrivial($"[Direct Driver] {nearbyVehicle.Model.Name} not in collection, adding to collection for path {paths[directDriver.Index].Waypoint[0].Path} with {paths[directDriver.Index].Waypoint.Count} waypoints"); GameFiber DirectTaskFiber = new GameFiber(() => TrafficPathing.DirectTask(TrafficPathing.collectedVehicles[nearbyVehicle.LicensePlate], paths[directDriver.Index].Waypoint)); diff --git a/SceneManager/Object Classes/ControlledVehicle.cs b/SceneManager/Object Classes/CollectedVehicle.cs similarity index 76% rename from SceneManager/Object Classes/ControlledVehicle.cs rename to SceneManager/Object Classes/CollectedVehicle.cs index b7a9492..a1c0970 100644 --- a/SceneManager/Object Classes/ControlledVehicle.cs +++ b/SceneManager/Object Classes/CollectedVehicle.cs @@ -2,7 +2,7 @@ namespace SceneManager { - public class ControlledVehicle + public class CollectedVehicle { public Vehicle Vehicle; public string LicensePlate; @@ -14,7 +14,7 @@ namespace SceneManager public bool StoppedAtWaypoint; public bool Redirected; - public ControlledVehicle(Vehicle vehicle, string licensePlate, int path, int totalWaypoints, int currentWaypoint, bool tasksAssigned, bool dismissNow, bool redirected) + public CollectedVehicle(Vehicle vehicle, string licensePlate, int path, int totalWaypoints, int currentWaypoint, bool tasksAssigned, bool dismissNow, bool redirected) { Vehicle = vehicle; LicensePlate = licensePlate; diff --git a/SceneManager/SceneManager.csproj b/SceneManager/SceneManager.csproj index 420631b..b137cc0 100644 --- a/SceneManager/SceneManager.csproj +++ b/SceneManager/SceneManager.csproj @@ -52,7 +52,7 @@ - + diff --git a/SceneManager/TrafficPathing.cs b/SceneManager/TrafficPathing.cs index d7497a3..558bc45 100644 --- a/SceneManager/TrafficPathing.cs +++ b/SceneManager/TrafficPathing.cs @@ -8,7 +8,7 @@ namespace SceneManager { public static class TrafficPathing { - public static Dictionary collectedVehicles = new Dictionary(); + public static Dictionary collectedVehicles = new Dictionary(); public static void WaypointVehicleCollector(List paths, Path path, Waypoint waypoint) { @@ -29,7 +29,7 @@ namespace SceneManager // If the vehicle is not in the collection yet if (!collectedVehicles.ContainsKey(v.LicensePlate)) { - var collectedVehicle = new ControlledVehicle(v, v.LicensePlate, path.PathNum, path.Waypoint.Count, waypoint.WaypointNum, true, false, false); + var collectedVehicle = new CollectedVehicle(v, v.LicensePlate, path.PathNum, path.Waypoint.Count, waypoint.WaypointNum, true, false, false); collectedVehicles.Add(v.LicensePlate, collectedVehicle); Game.LogTrivial($"[WaypointVehicleCollector] Added {v.Model.Name} to collection from path {path.PathNum}, waypoint {waypoint.WaypointNum}."); @@ -70,7 +70,7 @@ namespace SceneManager } } - private static void AssignTasks(ControlledVehicle collectedVehicle, List waypointData, Waypoint waypoint) + private static void AssignTasks(CollectedVehicle collectedVehicle, List waypointData, Waypoint waypoint) { if (waypointData.Count == 1) { @@ -85,7 +85,7 @@ namespace SceneManager } // TODO: Combine single and multiwaypoint tasks into one method - private static void AssignSingleWaypointTask(ControlledVehicle cv, List waypointData) + private static void AssignSingleWaypointTask(CollectedVehicle cv, List waypointData) { // Give driver a task to the single path waypoint. Run a loop with a condition checking for DismissNow for cases where the driver is dismissed or redirected Game.LogTrivial($"Assigning task for single waypoint."); @@ -109,7 +109,7 @@ namespace SceneManager } } - private static void AssignMultiWaypointTasks(ControlledVehicle cv, List waypointData, Waypoint collectorWaypoint) + private static void AssignMultiWaypointTasks(CollectedVehicle cv, List waypointData, Waypoint collectorWaypoint) { // For each waypoint in the path, give driver a task to that waypoint // i needs to be the index of the waypoint the vehicle was collected from @@ -173,7 +173,7 @@ namespace SceneManager DismissDriver(cv); } - private static void DismissDriver(ControlledVehicle cv) + private static void DismissDriver(CollectedVehicle cv) { cv.DismissNow = true; cv.StoppedAtWaypoint = false; @@ -214,7 +214,7 @@ namespace SceneManager } } - public static void DirectTask(ControlledVehicle cv, List waypointData) + public static void DirectTask(CollectedVehicle cv, List waypointData) { cv.DismissNow = false; if (cv.Vehicle && cv.Vehicle.Driver) @@ -239,7 +239,7 @@ namespace SceneManager Game.LogTrivial($"DirectTask loop over"); } - private static void VehicleDismissed(ControlledVehicle cv, List waypointData) + private static void VehicleDismissed(CollectedVehicle cv, List waypointData) { while (!cv.DismissNow) {