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

Commented out potentially useless code checking vehicle's distance to nearest collector upon dismissal.

This commit is contained in:
Rich Dunne 2020-10-04 13:53:31 -06:00
parent 334ec2358c
commit 70b0adbf8e

View file

@ -68,25 +68,27 @@ namespace SceneManager
if(dismissOption == DismissOption.FromWaypoint && CurrentWaypoint.Number == Path.Waypoints.Count || dismissOption == DismissOption.FromPath)
{
Logger.Log($"Dismissing from path");
Dismissed = true;
GameFiber.StartNew(() =>
{
// check if the vehicle is near any of the path's collector waypoints
//var nearestCollectorWaypoint = Path.Waypoints.Where(wp => wp.IsCollector && Vehicle.DistanceTo2D(wp.Position) <= wp.CollectorRadius * 2).FirstOrDefault();
var nearestCollectorWaypoint = Path.Waypoints.Where(wp => wp.IsCollector).OrderBy(wp => Vehicle.DistanceTo2D(wp.Position)).FirstOrDefault();
if(nearestCollectorWaypoint != null && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= 5f)
{
while (nearestCollectorWaypoint != null && Vehicle && Driver && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= 5f)
{
//Game.LogTrivial($"{Vehicle.Model.Name} is too close to the collector to be fully dismissed.");
GameFiber.Yield();
}
}
else if(nearestCollectorWaypoint != null)
//if(nearestCollectorWaypoint != null && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= 5f)
//{
// while (nearestCollectorWaypoint != null && Vehicle && Driver && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= 5f)
// {
// Game.LogTrivial($"{Vehicle.Model.Name} is within 5f of nearest collector to be fully dismissed.");
// GameFiber.Yield();
// }
//}
//else if
if(nearestCollectorWaypoint != null)
{
while (nearestCollectorWaypoint != null && Vehicle && Driver && Vehicle.FrontPosition.DistanceTo2D(nearestCollectorWaypoint.Position) <= nearestCollectorWaypoint.CollectorRadius * 2)
{
//Game.LogTrivial($"{Vehicle.Model.Name} is too close to the collector to be fully dismissed.");
Game.LogTrivial($"{Vehicle.Model.Name} is within 2x collector radius, cannot be fully dismissed yet.");
GameFiber.Yield();
}
}