mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
Added null checks for vehicles and drivers. Included valid vehicle check into GetNearbyVehicles method
This commit is contained in:
parent
a7fd140e1f
commit
c8874a5186
2 changed files with 23 additions and 7 deletions
|
|
@ -8,6 +8,12 @@ namespace SceneManager
|
|||
{
|
||||
public static void AssignWaypointTasks(CollectedVehicle collectedVehicle, List<Waypoint> waypoints, Waypoint currentWaypoint)
|
||||
{
|
||||
if(!collectedVehicle.Vehicle || !collectedVehicle.Vehicle.Driver)
|
||||
{
|
||||
Game.LogTrivial($"Collected vehicle or driver is null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentWaypoint != null && currentWaypoint.DrivingFlag == VehicleDrivingFlags.StopAtDestination)
|
||||
{
|
||||
StopVehicleAtWaypoint(collectedVehicle);
|
||||
|
|
@ -15,6 +21,11 @@ namespace SceneManager
|
|||
|
||||
DriveVehicleToNextWaypoint(collectedVehicle, waypoints, currentWaypoint);
|
||||
|
||||
if (!collectedVehicle.Vehicle || !collectedVehicle.Vehicle.Driver)
|
||||
{
|
||||
Game.LogTrivial($"Collected vehicle or driver is null");
|
||||
return;
|
||||
}
|
||||
Game.LogTrivial($"{collectedVehicle.Vehicle.Model.Name} all tasks complete.");
|
||||
DismissDriver(collectedVehicle);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue