public VehicleAIConnection(CalculateTargetSpeedDelegate calculateTargetSpeedDelegate,
                            PathfindFailureDelegate pathfindFailureDelegate,
                            PathfindSuccessDelegate pathfindSuccessDelegate,
                            InvalidPathDelegate invalidPathDelegate,
                            ParkVehicleDelegate parkVehicleDelegate,
                            NeedChangeVehicleTypeDelegate needChangeVehicleTypeDelegate,
                            CalculateSegmentPositionDelegate calculateSegmentPosition,
                            CalculateSegmentPositionDelegate2 calculateSegmentPosition2,
                            ChangeVehicleTypeDelegate changeVehicleTypeDelegate,
                            UpdateNodeTargetPosDelegate updateNodeTargetPosDelegate,
                            ArrivingToDestinationDelegate arrivingToDestinationDelegate,
                            LeftHandDriveDelegate leftHandDriveDelegate)
 {
     CalculateTargetSpeed      = calculateTargetSpeedDelegate ?? throw new ArgumentNullException(nameof(calculateTargetSpeedDelegate));
     PathfindFailure           = pathfindFailureDelegate ?? throw new ArgumentNullException(nameof(pathfindFailureDelegate));
     PathfindSuccess           = pathfindSuccessDelegate ?? throw new ArgumentNullException(nameof(pathfindSuccessDelegate));
     InvalidPath               = invalidPathDelegate ?? throw new ArgumentNullException(nameof(invalidPathDelegate));
     ParkVehicle               = parkVehicleDelegate ?? throw new ArgumentNullException(nameof(parkVehicleDelegate));
     NeedChangeVehicleType     = needChangeVehicleTypeDelegate ?? throw new ArgumentNullException(nameof(needChangeVehicleTypeDelegate));
     CalculateSegmentPosition  = calculateSegmentPosition ?? throw new ArgumentNullException(nameof(calculateSegmentPosition));
     CalculateSegmentPosition2 = calculateSegmentPosition2 ?? throw new ArgumentNullException(nameof(calculateSegmentPosition2));
     ChangeVehicleType         = changeVehicleTypeDelegate ?? throw new ArgumentNullException(nameof(changeVehicleTypeDelegate));
     UpdateNodeTargetPos       = updateNodeTargetPosDelegate ?? throw new ArgumentNullException(nameof(updateNodeTargetPosDelegate));
     ArrivingToDestination     = arrivingToDestinationDelegate ?? throw new ArgumentNullException(nameof(arrivingToDestinationDelegate));
     LeftHandDrive             = leftHandDriveDelegate ?? throw new ArgumentNullException(nameof(leftHandDriveDelegate));
 }
コード例 #2
0
        internal static VehicleAIConnection GetConnection()
        {
            try {
                CalculateTargetSpeedDelegate      calculateTargetSpeedDelegate  = TranspilerUtil.CreateDelegate <CalculateTargetSpeedDelegate>(typeof(VehicleAI), "CalculateTargetSpeed", true);
                PathfindFailureDelegate           pathfindFailureDelegate       = TranspilerUtil.CreateDelegate <PathfindFailureDelegate>(typeof(CarAI), "PathfindFailure", true);
                PathfindSuccessDelegate           pathfindSuccessDelegate       = TranspilerUtil.CreateDelegate <PathfindSuccessDelegate>(typeof(CarAI), "PathfindSuccess", true);
                InvalidPathDelegate               invalidPathDelegate           = TranspilerUtil.CreateDelegate <InvalidPathDelegate>(typeof(VehicleAI), "InvalidPath", true);
                ParkVehicleDelegate               parkVehicleDelegate           = TranspilerUtil.CreateDelegate <ParkVehicleDelegate>(typeof(VehicleAI), "ParkVehicle", true);
                NeedChangeVehicleTypeDelegate     needChangeVehicleTypeDelegate = TranspilerUtil.CreateDelegate <NeedChangeVehicleTypeDelegate>(typeof(VehicleAI), "NeedChangeVehicleType", true);
                CalculateSegmentPositionDelegate  calculateSegmentPosition      = TranspilerUtil.CreateDelegate <CalculateSegmentPositionDelegate>(typeof(VehicleAI), "CalculateSegmentPosition", true);
                CalculateSegmentPositionDelegate2 calculateSegmentPosition2     = TranspilerUtil.CreateDelegate <CalculateSegmentPositionDelegate2>(typeof(VehicleAI), "CalculateSegmentPosition", true);
                ChangeVehicleTypeDelegate         changeVehicleTypeDelegate     = TranspilerUtil.CreateDelegate <ChangeVehicleTypeDelegate>(typeof(VehicleAI), "ChangeVehicleType", true);
                UpdateNodeTargetPosDelegate       updateNodeTargetPosDelegate   = TranspilerUtil.CreateDelegate <UpdateNodeTargetPosDelegate>(typeof(VehicleAI), "UpdateNodeTargetPos", true);
                ArrivingToDestinationDelegate     arrivingToDestinationDelegate = TranspilerUtil.CreateDelegate <ArrivingToDestinationDelegate>(typeof(VehicleAI), "ArrivingToDestination", true);
                LeftHandDriveDelegate             leftHandDriveDelegate         = TranspilerUtil.CreateDelegate <LeftHandDriveDelegate>(typeof(VehicleAI), "LeftHandDrive", true);

                return(new VehicleAIConnection(calculateTargetSpeedDelegate,
                                               pathfindFailureDelegate,
                                               pathfindSuccessDelegate,
                                               invalidPathDelegate,
                                               parkVehicleDelegate,
                                               needChangeVehicleTypeDelegate,
                                               calculateSegmentPosition,
                                               calculateSegmentPosition2,
                                               changeVehicleTypeDelegate,
                                               updateNodeTargetPosDelegate,
                                               arrivingToDestinationDelegate,
                                               leftHandDriveDelegate));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }