/// <summary>Creates a game connection object for the tourist AI class.</summary> /// <returns>A new <see cref="TouristAIConnection{TouristAI, Citizen}"/> object.</returns> public static TouristAIConnection<TouristAI, Citizen> GetTouristAIConnection() { try { GetRandomTargetTypeDelegate getRandomTargetType = FastDelegateFactory.Create<GetRandomTargetTypeDelegate>(typeof(TouristAI), "GetRandomTargetType", instanceMethod: true); GetLeavingReasonDelegate getLeavingReason = FastDelegateFactory.Create<GetLeavingReasonDelegate>(typeof(TouristAI), "GetLeavingReason", instanceMethod: true); AddTouristVisitDelegate addTouristVisit = FastDelegateFactory.Create<AddTouristVisitDelegate>(typeof(TouristAI), "AddTouristVisit", instanceMethod: true); DoRandomMoveDelegate doRandomMove = FastDelegateFactory.Create<DoRandomMoveDelegate>(typeof(TouristAI), "DoRandomMove", instanceMethod: true); FindEvacuationPlaceDelegate findEvacuationPlace = FastDelegateFactory.Create<FindEvacuationPlaceDelegate>(typeof(TouristAI), "FindEvacuationPlace", instanceMethod: true); FindVisitPlaceDelegate findVisitPlace = FastDelegateFactory.Create<FindVisitPlaceDelegate>(typeof(TouristAI), "FindVisitPlace", instanceMethod: true); GetEntertainmentReasonDelegate getEntertainmentReason = FastDelegateFactory.Create<GetEntertainmentReasonDelegate>(typeof(TouristAI), "GetEntertainmentReason", instanceMethod: true); GetEvacuationReasonDelegate getEvacuationReason = FastDelegateFactory.Create<GetEvacuationReasonDelegate>(typeof(TouristAI), "GetEvacuationReason", instanceMethod: true); GetShoppingReasonDelegate getShoppingReason = FastDelegateFactory.Create<GetShoppingReasonDelegate>(typeof(TouristAI), "GetShoppingReason", instanceMethod: true); StartMovingDelegate startMoving = FastDelegateFactory.Create<StartMovingDelegate>(typeof(TouristAI), "StartMoving", instanceMethod: true); return new TouristAIConnection<TouristAI, Citizen>( getRandomTargetType, getLeavingReason, addTouristVisit, doRandomMove, findEvacuationPlace, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving); } catch (Exception e) { Log.Error("The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: " + e); return null; } }
/// <summary>Creates a game connection object for the tourist AI class.</summary> /// <returns>A new <see cref="TouristAIConnection{TouristAI, Citizen}"/> object.</returns> public static TouristAIConnection <TouristAI, Citizen> GetTouristAIConnection() { try { GetRandomTargetTypeDelegate getRandomTargetType = FastDelegate.Create <TouristAI, GetRandomTargetTypeDelegate>("GetRandomTargetType"); GetLeavingReasonDelegate getLeavingReason = FastDelegate.Create <TouristAI, GetLeavingReasonDelegate>("GetLeavingReason"); AddTouristVisitDelegate addTouristVisit = FastDelegate.Create <TouristAI, AddTouristVisitDelegate>("AddTouristVisit"); DoRandomMoveDelegate doRandomMove = FastDelegate.Create <TouristAI, DoRandomMoveDelegate>("DoRandomMove"); FindEvacuationPlaceDelegate findEvacuationPlace = FastDelegate.Create <TouristAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace"); FindVisitPlaceDelegate findVisitPlace = FastDelegate.Create <TouristAI, FindVisitPlaceDelegate>("FindVisitPlace"); GetEntertainmentReasonDelegate getEntertainmentReason = FastDelegate.Create <TouristAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason"); GetEvacuationReasonDelegate getEvacuationReason = FastDelegate.Create <TouristAI, GetEvacuationReasonDelegate>("GetEvacuationReason"); GetShoppingReasonDelegate getShoppingReason = FastDelegate.Create <TouristAI, GetShoppingReasonDelegate>("GetShoppingReason"); StartMovingDelegate startMoving = FastDelegate.Create <TouristAI, StartMovingDelegate>("StartMoving"); return(new TouristAIConnection <TouristAI, Citizen>( getRandomTargetType, getLeavingReason, addTouristVisit, doRandomMove, findEvacuationPlace, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving)); } catch (Exception e) { Log.Error("The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: " + e); return(null); } }
/// <summary>Creates a game connection object for the resident AI class.</summary> /// <returns>A new <see cref="ResidentAIConnection{ResidentAI, Citizen}"/> object.</returns> public static ResidentAIConnection <ResidentAI, Citizen> GetResidentAIConnection() { try { DoRandomMoveDelegate doRandomMove = FastDelegateFactory.Create <DoRandomMoveDelegate>(typeof(ResidentAI), "DoRandomMove", instanceMethod: true); FindEvacuationPlaceDelegate findEvacuationPlace = FastDelegateFactory.Create <FindEvacuationPlaceDelegate>(typeof(ResidentAI), "FindEvacuationPlace", instanceMethod: true); FindHospitalDelegate findHospital = FastDelegateFactory.Create <FindHospitalDelegate>(typeof(ResidentAI), "FindHospital", instanceMethod: true); FindVisitPlaceDelegate findVisitPlace = FastDelegateFactory.Create <FindVisitPlaceDelegate>(typeof(ResidentAI), "FindVisitPlace", instanceMethod: true); GetEntertainmentReasonDelegate getEntertainmentReason = FastDelegateFactory.Create <GetEntertainmentReasonDelegate>(typeof(ResidentAI), "GetEntertainmentReason", instanceMethod: true); GetEvacuationReasonDelegate getEvacuationReason = FastDelegateFactory.Create <GetEvacuationReasonDelegate>(typeof(ResidentAI), "GetEvacuationReason", instanceMethod: true); GetShoppingReasonDelegate getShoppingReason = FastDelegateFactory.Create <GetShoppingReasonDelegate>(typeof(ResidentAI), "GetShoppingReason", instanceMethod: true); StartMovingDelegate startMoving = FastDelegateFactory.Create <StartMovingDelegate>(typeof(ResidentAI), "StartMoving", instanceMethod: true); StartMovingWithOfferDelegate startMovingWithOffer = FastDelegateFactory.Create <StartMovingWithOfferDelegate>(typeof(ResidentAI), "StartMoving", instanceMethod: true); AttemptAutodidactDelegate attemptAutodidact = FastDelegateFactory.Create <AttemptAutodidactDelegate>(typeof(ResidentAI), "AttemptAutodidact", instanceMethod: true); return(new ResidentAIConnection <ResidentAI, Citizen>( doRandomMove, findEvacuationPlace, findHospital, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving, startMovingWithOffer, attemptAutodidact)); } catch (Exception e) { Log.Error("The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: " + e); return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="ResidentAIConnection{TAI, TCitizen}"/> class. /// </summary> /// <param name="doRandomMove"> /// A method that corresponds to the AI's original <c>RandomMove</c> method. /// </param> /// <param name="findEvacuationPlace"> /// A method that corresponds to the AI's original <c>FindEvacuationPlace</c> method. /// </param> /// <param name="findHospital"> /// A method that corresponds to the AI's original <c>FindHospital</c> method. /// </param> /// <param name="findVisitPlace"> /// A method that corresponds to the AI's original <c>FindVisitPlace</c> method. /// </param> /// <param name="getEntertainmentReason"> /// A method that corresponds to the AI's original <c>GetEntertainmentReason</c> method. /// </param> /// <param name="getEvacuationReason"> /// A method that corresponds to the AI's original <c>GetEvacuationReason</c> method. /// </param> /// <param name="getShoppingReason"> /// A method that corresponds to the AI's original <c>GetShoppingReason</c> method. /// </param> /// <param name="startMoving"> /// A method that corresponds to the AI's original <c>StartMoving</c> method specifying a /// target building ID. /// </param> /// <param name="startMovingWithOffer"> /// A method that corresponds to the AI's original <c>StartMoving</c> method specifying a /// transfer offer. /// </param> /// <exception cref="ArgumentNullException">Thrown when any argument is null.</exception> public ResidentAIConnection( DoRandomMoveDelegate doRandomMove, FindEvacuationPlaceDelegate findEvacuationPlace, FindHospitalDelegate findHospital, FindVisitPlaceDelegate findVisitPlace, GetEntertainmentReasonDelegate getEntertainmentReason, GetEvacuationReasonDelegate getEvacuationReason, GetShoppingReasonDelegate getShoppingReason, StartMovingDelegate startMoving, StartMovingWithOfferDelegate startMovingWithOffer) : base(doRandomMove, findEvacuationPlace, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving) { FindHospital = findHospital ?? throw new ArgumentNullException(nameof(findHospital)); StartMovingWithOffer = startMovingWithOffer ?? throw new ArgumentNullException(nameof(startMovingWithOffer)); }
/// <summary>Creates a game connection object for the resident AI class.</summary> /// <returns>A new <see cref="ResidentAIConnection{ResidentAI, Citizen}"/> object.</returns> public static ResidentAIConnection <ResidentAI, Citizen> GetResidentAIConnection() { try { DoRandomMoveDelegate doRandomMove = FastDelegate.Create <ResidentAI, DoRandomMoveDelegate>("DoRandomMove"); FindEvacuationPlaceDelegate findEvacuationPlace = FastDelegate.Create <ResidentAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace"); FindHospitalDelegate findHospital = FastDelegate.Create <ResidentAI, FindHospitalDelegate>("FindHospital"); FindVisitPlaceDelegate findVisitPlace = FastDelegate.Create <ResidentAI, FindVisitPlaceDelegate>("FindVisitPlace"); GetEntertainmentReasonDelegate getEntertainmentReason = FastDelegate.Create <ResidentAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason"); GetEvacuationReasonDelegate getEvacuationReason = FastDelegate.Create <ResidentAI, GetEvacuationReasonDelegate>("GetEvacuationReason"); GetShoppingReasonDelegate getShoppingReason = FastDelegate.Create <ResidentAI, GetShoppingReasonDelegate>("GetShoppingReason"); StartMovingDelegate startMoving = FastDelegate.Create <ResidentAI, StartMovingDelegate>("StartMoving"); StartMovingWithOfferDelegate startMovingWithOffer = FastDelegate.Create <ResidentAI, StartMovingWithOfferDelegate>("StartMoving"); return(new ResidentAIConnection <ResidentAI, Citizen>( doRandomMove, findEvacuationPlace, findHospital, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving, startMovingWithOffer)); } catch (Exception e) { Log.Error("The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: " + e); return(null); } }
/// <summary>Initializes a new instance of the <see cref="HumanAIConnectionBase{TAI, TCitizen}"/> class.</summary> /// <param name="doRandomMove">A method that corresponds to the AI's original <c>RandomMove</c> method.</param> /// <param name="findEvacuationPlace"> /// A method that corresponds to the AI's original <c>FindEvacuationPlace</c> method. /// </param> /// <param name="findVisitPlace">A method that corresponds to the AI's original <c>FindVisitPlace</c> method.</param> /// <param name="getEntertainmentReason"> /// A method that corresponds to the AI's original <c>GetEntertainmentReason</c> method. /// </param> /// <param name="getEvacuationReason"> /// A method that corresponds to the AI's original <c>GetEvacuationReason</c> method. /// </param> /// <param name="getShoppingReason"> /// A method that corresponds to the AI's original <c>GetShoppingReason</c> method. /// </param> /// <param name="startMoving"> /// A method that corresponds to the AI's original <c>StartMoving</c> method specifying a target building ID. /// </param> /// <exception cref="ArgumentNullException">Thrown when any argument is null.</exception> protected HumanAIConnectionBase( DoRandomMoveDelegate doRandomMove, FindEvacuationPlaceDelegate findEvacuationPlace, FindVisitPlaceDelegate findVisitPlace, GetEntertainmentReasonDelegate getEntertainmentReason, GetEvacuationReasonDelegate getEvacuationReason, GetShoppingReasonDelegate getShoppingReason, StartMovingDelegate startMoving) { DoRandomMove = doRandomMove ?? throw new ArgumentNullException(nameof(doRandomMove)); FindEvacuationPlace = findEvacuationPlace ?? throw new ArgumentNullException(nameof(findEvacuationPlace)); FindVisitPlace = findVisitPlace ?? throw new ArgumentNullException(nameof(findVisitPlace)); GetEntertainmentReason = getEntertainmentReason ?? throw new ArgumentNullException(nameof(getEntertainmentReason)); GetEvacuationReason = getEvacuationReason ?? throw new ArgumentNullException(nameof(getEvacuationReason)); GetShoppingReason = getShoppingReason ?? throw new ArgumentNullException(nameof(getShoppingReason)); StartMoving = startMoving ?? throw new ArgumentNullException(nameof(startMoving)); }
/// <summary> /// Initializes a new instance of the <see cref="TouristAIConnection{TAI, TCitizen}" /> class. /// </summary> /// <param name="getRandomTargetType">A method that corresponds to the AI's original <c>GetRandomTargetType</c> method.</param> /// <param name="getLeavingReason">A method that corresponds to the AI's original <c>GetLeavingReason</c> method.</param> /// <param name="addTouristVisit">A method that corresponds to the AI's original <c>AddTouristVisit</c> method.</param> /// <param name="doRandomMove">A method that corresponds to the AI's original <c>RandomMove</c> method.</param> /// <param name="findEvacuationPlace">A method that corresponds to the AI's original <c>FindEvacuationPlace</c> method.</param> /// <param name="findVisitPlace">A method that corresponds to the AI's original <c>FindVisitPlace</c> method.</param> /// <param name="getEntertainmentReason">A method that corresponds to the AI's original <c>GetEntertainmentReason</c> method.</param> /// <param name="getEvacuationReason">A method that corresponds to the AI's original <c>GetEvacuationReason</c> method.</param> /// <param name="getShoppingReason">A method that corresponds to the AI's original <c>GetShoppingReason</c> method.</param> /// <param name="startMoving">A method that corresponds to the AI's original <c>StartMoving</c> method specifying a /// target building ID.</param> /// <exception cref="ArgumentNullException">Thrown when any argument is null.</exception> public TouristAIConnection( GetRandomTargetTypeDelegate getRandomTargetType, GetLeavingReasonDelegate getLeavingReason, AddTouristVisitDelegate addTouristVisit, DoRandomMoveDelegate doRandomMove, FindEvacuationPlaceDelegate findEvacuationPlace, FindVisitPlaceDelegate findVisitPlace, GetEntertainmentReasonDelegate getEntertainmentReason, GetEvacuationReasonDelegate getEvacuationReason, GetShoppingReasonDelegate getShoppingReason, StartMovingDelegate startMoving) : base(doRandomMove, findEvacuationPlace, findVisitPlace, getEntertainmentReason, getEvacuationReason, getShoppingReason, startMoving) { GetRandomTargetType = getRandomTargetType ?? throw new ArgumentNullException(nameof(getRandomTargetType)); GetLeavingReason = getLeavingReason ?? throw new ArgumentNullException(nameof(getLeavingReason)); AddTouristVisit = addTouristVisit ?? throw new ArgumentNullException(nameof(addTouristVisit)); }