internal static ResidentAIConnection GetConnection() { try { GetTaxiProbabilityResidentDelegate getTaxiProbability = TranspilerUtil.CreateDelegate <GetTaxiProbabilityResidentDelegate>( typeof(ResidentAI), "GetTaxiProbability", true); GetBikeProbabilityResidentDelegate getBikeProbability = TranspilerUtil.CreateDelegate <GetBikeProbabilityResidentDelegate>( typeof(ResidentAI), "GetBikeProbability", true); GetCarProbabilityResidentDelegate getCarProbability = TranspilerUtil.CreateDelegate <GetCarProbabilityResidentDelegate>( typeof(ResidentAI), "GetCarProbability", true); GetElectricCarProbabilityResidentDelegate getElectricCarProbability = TranspilerUtil.CreateDelegate <GetElectricCarProbabilityResidentDelegate>( typeof(ResidentAI), "GetElectricCarProbability", true); return(new ResidentAIConnection( getTaxiProbability, getBikeProbability, getCarProbability, getElectricCarProbability)); } catch (Exception e) { Log.Error(e.Message); return(null); } }
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); } }
internal static TrainAIConnection GetConnection() { try { UpdatePathTargetPositionsDelegate updatePathTargetPositionsDelegate = TranspilerUtil.CreateDelegate <UpdatePathTargetPositionsDelegate>( typeof(TrainAI), "UpdatePathTargetPositions", true); GetNoiseLevelDelegate getNoiseLevelDelegate = TranspilerUtil.CreateDelegate <GetNoiseLevelDelegate>( typeof(TrainAI), "GetNoiseLevel", true); GetMaxSpeedDelegate getMaxSpeedDelegate = TranspilerUtil.CreateDelegate <GetMaxSpeedDelegate>( typeof(TrainAI), "GetMaxSpeed", false); CalculateMaxSpeedDelegate calculateMaxSpeedDelegate = TranspilerUtil.CreateDelegate <CalculateMaxSpeedDelegate>( typeof(TrainAI), "CalculateMaxSpeed", false); ReverseDelegate reverseDelegate = TranspilerUtil.CreateDelegate <ReverseDelegate>( typeof(TrainAI), "Reverse", false); CalculateTargetSpeedTrainDelegate calculateTargetSpeedDelegate = TranspilerUtil.CreateDelegate <CalculateTargetSpeedTrainDelegate>( typeof(TrainAI), "CalculateTargetSpeed", true); CheckOverlapDelegate checkOverlapDelegate = TranspilerUtil.CreateDelegate <CheckOverlapDelegate>( typeof(TrainAI), "CheckOverlap", false); ForceTrafficLightsDelegate forceTrafficLightsDelegate = TranspilerUtil.CreateDelegate <ForceTrafficLightsDelegate>( typeof(TrainAI), "ForceTrafficLights", true); return(new TrainAIConnection( updatePathTargetPositionsDelegate, getNoiseLevelDelegate, getMaxSpeedDelegate, calculateMaxSpeedDelegate, reverseDelegate, calculateTargetSpeedDelegate, checkOverlapDelegate, forceTrafficLightsDelegate)); } catch (Exception e) { Log.Error(e.Message); return(null); } }
internal static HumanAIConnection GetConnection() { try { StartPathFindDelegate startPathFindCitizenAI = TranspilerUtil.CreateDelegate <StartPathFindDelegate>( typeof(CitizenAI), "StartPathFind", true); SimulationStepDelegate simulationStepCitizenAI = AccessTools.MethodDelegate <SimulationStepDelegate>( TranspilerUtil.DeclaredMethod <SimulationStepTarget>(typeof(CitizenAI), "SimulationStep"), null, false); ArriveAtDestinationDelegate arriveAtDestination = TranspilerUtil.CreateDelegate <ArriveAtDestinationDelegate>( typeof(HumanAI), "ArriveAtDestination", true); SpawnDelegate spawnCitizenAI = TranspilerUtil.CreateDelegate <SpawnDelegate>( typeof(HumanAI), "Spawn", true); InvalidPathHumanAIDelegate invalidPath = TranspilerUtil.CreateDelegate <InvalidPathHumanAIDelegate>( typeof(CitizenAI), "InvalidPath", true); PathfindFailureHumanAIDelegate pathfindFailure = TranspilerUtil.CreateDelegate <PathfindFailureHumanAIDelegate>( typeof(HumanAI), "PathfindFailure", true); PathfindSuccessHumanAIDelegate pathfindSuccess = TranspilerUtil.CreateDelegate <PathfindSuccessHumanAIDelegate>( typeof(HumanAI), "PathfindSuccess", true); return(new HumanAIConnection( spawnCitizenAI, startPathFindCitizenAI, simulationStepCitizenAI, arriveAtDestination, invalidPath, pathfindFailure, pathfindSuccess)); } catch (Exception e) { Log.Error(e.Message); return(null); } }
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); } }