From 70b0adbf8ed0d4567ad0a5617b1a2c2f8cfc25f0 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Sun, 4 Oct 2020 13:53:31 -0600 Subject: [PATCH] Commented out potentially useless code checking vehicle's distance to nearest collector upon dismissal. --- .../Object Classes/CollectedVehicle.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/SceneManager/Object Classes/CollectedVehicle.cs b/SceneManager/Object Classes/CollectedVehicle.cs index da5eeca..497bc1a 100644 --- a/SceneManager/Object Classes/CollectedVehicle.cs +++ b/SceneManager/Object Classes/CollectedVehicle.cs @@ -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(); } }