public static void Prepare()
 {
     GetTaxiProbability        = GameConnectionManager.Instance.TouristAIConnection.GetTaxiProbability;
     GetBikeProbability        = GameConnectionManager.Instance.TouristAIConnection.GetBikeProbability;
     GetCarProbability         = GameConnectionManager.Instance.TouristAIConnection.GetCarProbability;
     GetElectricCarProbability = GameConnectionManager.Instance.TouristAIConnection.GetElectricCarProbability;
     GetCamperProbability      = GameConnectionManager.Instance.TouristAIConnection.GetCamperProbability;
 }
Beispiel #2
0
 internal TouristAIConnection(GetTaxiProbabilityDelegate getTaxiProbability,
                              GetBikeProbabilityDelegate getBikeProbability,
                              GetCarProbabilityDelegate getCarProbability,
                              GetElectricCarProbabilityDelegate getElectricCarProbability,
                              GetCamperProbabilityDelegate getCamperProbabilityDelegate)
 {
     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));
     GetCamperProbability      = getCamperProbabilityDelegate ?? throw new ArgumentNullException(nameof(getCamperProbabilityDelegate));
 }
        internal static TouristAIConnection GetConnection()
        {
            try {
                GetTaxiProbabilityDelegate getTaxiProbability =
                    TranspilerUtil.CreateDelegate <GetTaxiProbabilityDelegate>(
                        typeof(TouristAI),
                        "GetTaxiProbability",
                        true);
                GetBikeProbabilityDelegate getBikeProbability =
                    TranspilerUtil.CreateDelegate <GetBikeProbabilityDelegate>(
                        typeof(TouristAI),
                        "GetBikeProbability",
                        true);
                GetCarProbabilityDelegate getCarProbability =
                    TranspilerUtil.CreateDelegate <GetCarProbabilityDelegate>(
                        typeof(TouristAI),
                        "GetCarProbability",
                        true);
                GetElectricCarProbabilityDelegate getElectricCarProbability =
                    TranspilerUtil.CreateDelegate <GetElectricCarProbabilityDelegate>(
                        typeof(TouristAI),
                        "GetElectricCarProbability",
                        true);
                GetCamperProbabilityDelegate getCamperProbability =
                    TranspilerUtil.CreateDelegate <GetCamperProbabilityDelegate>(
                        typeof(TouristAI),
                        "GetCamperProbability",
                        true);


                return(new TouristAIConnection(
                           getTaxiProbability,
                           getBikeProbability,
                           getCarProbability,
                           getElectricCarProbability,
                           getCamperProbability));
            } catch (Exception e) {
                Log.Error(e.Message);
                return(null);
            }
        }