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

Renamed ControlledVehicle object and class to CollectedVehicle

This commit is contained in:
Rich Dunne 2020-08-20 08:47:28 -06:00
parent 2d85e65b32
commit c48d1ea8ed
4 changed files with 13 additions and 13 deletions

View file

@ -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<string, ControlledVehicle> cv in pathVehicles.Where(cv => cv.Value.Vehicle && cv.Value.Vehicle.Driver))
foreach (KeyValuePair<string, CollectedVehicle> 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));

View file

@ -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;

View file

@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Menus\BarrierMenu.cs" />
<Compile Include="Object Classes\ControlledVehicle.cs" />
<Compile Include="Object Classes\CollectedVehicle.cs" />
<Compile Include="Menus\EditPathMenu.cs" />
<Compile Include="Menus\EditWaypointMenu.cs" />
<Compile Include="EntryPoint.cs" />

View file

@ -8,7 +8,7 @@ namespace SceneManager
{
public static class TrafficPathing
{
public static Dictionary<string, ControlledVehicle> collectedVehicles = new Dictionary<string, ControlledVehicle>();
public static Dictionary<string, CollectedVehicle> collectedVehicles = new Dictionary<string, CollectedVehicle>();
public static void WaypointVehicleCollector(List<Path> 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<Waypoint> waypointData, Waypoint waypoint)
private static void AssignTasks(CollectedVehicle collectedVehicle, List<Waypoint> 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<Waypoint> waypointData)
private static void AssignSingleWaypointTask(CollectedVehicle cv, List<Waypoint> 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<Waypoint> waypointData, Waypoint collectorWaypoint)
private static void AssignMultiWaypointTasks(CollectedVehicle cv, List<Waypoint> 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<Waypoint> waypointData)
public static void DirectTask(CollectedVehicle cv, List<Waypoint> 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<Waypoint> waypointData)
private static void VehicleDismissed(CollectedVehicle cv, List<Waypoint> waypointData)
{
while (!cv.DismissNow)
{