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

Preparing to remove VehicleDismissed function

This commit is contained in:
Rich Dunne 2020-09-06 09:22:41 -06:00
parent 82590778d3
commit 0320497fde

View file

@ -105,34 +105,34 @@ namespace SceneManager
} }
} }
private static void VehicleDismissed(CollectedVehicle cv, List<Waypoint> waypointData) //private static void VehicleDismissed(CollectedVehicle cv, List<Waypoint> waypointData)
{ //{
while (!cv.DismissNow) // while (!cv.DismissNow)
{ // {
GameFiber.Sleep(500); // GameFiber.Sleep(500);
} // }
Game.LogTrivial($"{cv.Vehicle.Model.Name} was dismissed (dismissal check loop)."); // Game.LogTrivial($"{cv.Vehicle.Model.Name} was dismissed (dismissal check loop).");
Game.LogTrivial($"Looping to ensure the vehicle is far enough away from all attractor waypoints so it can be removed from the collection."); // Game.LogTrivial($"Looping to ensure the vehicle is far enough away from all attractor waypoints so it can be removed from the collection.");
while (true) // while (true)
{ // {
var collectorWaypoints = waypointData.Where(wp => wp.IsCollector); // var collectorWaypoints = waypointData.Where(wp => wp.IsCollector);
var vehicleFarEnoughAwayFromCollectors = collectorWaypoints.All(wp => cv.Vehicle.DistanceTo(wp.Position) > wp.CollectorRadius); // var vehicleFarEnoughAwayFromCollectors = collectorWaypoints.All(wp => cv.Vehicle.DistanceTo(wp.Position) > wp.CollectorRadius);
if (collectedVehicles.Contains(cv) && vehicleFarEnoughAwayFromCollectors) // if (collectedVehicles.Contains(cv) && vehicleFarEnoughAwayFromCollectors)
{ // {
Game.LogTrivial($"{cv.Vehicle.Model.Name} is far enough away from all attractor waypoints and has been removed from the collection."); // Game.LogTrivial($"{cv.Vehicle.Model.Name} is far enough away from all attractor waypoints and has been removed from the collection.");
cv.SetTasksAssigned(false); // cv.SetTasksAssigned(false);
cv.Vehicle.Driver.BlockPermanentEvents = false; // cv.Vehicle.Driver.BlockPermanentEvents = false;
cv.Vehicle.Driver.IsPersistent = false; // cv.Vehicle.Driver.IsPersistent = false;
cv.Vehicle.IsPersistent = false; // cv.Vehicle.IsPersistent = false;
collectedVehicles.Remove(cv); // collectedVehicles.Remove(cv);
break; // break;
} // }
GameFiber.Sleep(1000); // GameFiber.Sleep(1000);
} // }
} //}
} }
} }