internal PassengerCarAIConnection(FindParkingSpaceDelegate findParkingSpaceDelegate,
                                   FindParkingSpacePropDelegate findParkingSpacePropDelegate,
                                   FindParkingSpaceRoadSideDelegate findParkingSpaceRoadSideDelegate,
                                   GetDriverInstanceDelegate getDriverInstanceDelegate)
 {
     FindParkingSpace         = findParkingSpaceDelegate ?? throw new ArgumentNullException(nameof(findParkingSpaceDelegate));
     FindParkingSpaceProp     = findParkingSpacePropDelegate ?? throw new ArgumentNullException(nameof(findParkingSpacePropDelegate));
     FindParkingSpaceRoadSide = findParkingSpaceRoadSideDelegate ?? throw new ArgumentNullException(nameof(findParkingSpaceRoadSideDelegate));
     GetDriverInstance        = getDriverInstanceDelegate ?? throw new ArgumentNullException(nameof(getDriverInstanceDelegate));
 }
        internal static PassengerCarAIConnection GetConnection()
        {
            try {
                FindParkingSpaceDelegate findParkingSpaceDelegate =
                    AccessTools.MethodDelegate <FindParkingSpaceDelegate>(TargetMethod());
                FindParkingSpacePropDelegate findParkingSpacePropDelegate =
                    AccessTools.MethodDelegate <FindParkingSpacePropDelegate>(TargetMethodProp());
                FindParkingSpaceRoadSideDelegate findParkingSpaceRoadSideDelegate =
                    AccessTools.MethodDelegate <FindParkingSpaceRoadSideDelegate>(TargetMethodRoadSide());
                GetDriverInstanceDelegate getDriverInstanceDelegate =
                    TranspilerUtil.CreateDelegate <GetDriverInstanceDelegate>(typeof(PassengerCarAI), "GetDriverInstance", true);

                return(new PassengerCarAIConnection(findParkingSpaceDelegate,
                                                    findParkingSpacePropDelegate,
                                                    findParkingSpaceRoadSideDelegate,
                                                    getDriverInstanceDelegate));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }