public static void Prepare() { GetTaxiProbability = GameConnectionManager.Instance.ResidentAIConnection.GetTaxiProbability; GetBikeProbability = GameConnectionManager.Instance.ResidentAIConnection.GetBikeProbability; GetCarProbability = GameConnectionManager.Instance.ResidentAIConnection.GetCarProbability; GetElectricCarProbability = GameConnectionManager.Instance.ResidentAIConnection.GetElectricCarProbability; }
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 ResidentAIConnection(GetTaxiProbabilityResidentDelegate getTaxiProbability, GetBikeProbabilityResidentDelegate getBikeProbability, GetCarProbabilityResidentDelegate getCarProbability, GetElectricCarProbabilityResidentDelegate getElectricCarProbability) { GetTaxiProbability = getTaxiProbability ?? throw new ArgumentNullException(nameof(getTaxiProbability)); GetBikeProbability = getBikeProbability ?? throw new ArgumentNullException(nameof(getBikeProbability)); GetCarProbability = getCarProbability ?? throw new ArgumentNullException(nameof(getCarProbability)); GetElectricCarProbability = getElectricCarProbability ?? throw new ArgumentNullException(nameof(getElectricCarProbability)); }