public PurchaseOptimizer(
     Self selfInventory,
     Other otherInventory,
     IEnumerable <Resource> tradeableResources,
     IExchange <Resource, Self, Other> exchange,
     IUtilityEvaluator <Resource, Self> utilityFunctions)
 {
     this.selfInventory      = selfInventory;
     this.otherInventory     = otherInventory;
     this.tradeableResources = tradeableResources.ToList();
     this.exchange           = exchange;
     this.utilityFunctions   = utilityFunctions;
 }
Пример #2
0
 private void Awake()
 {
     objectSeeker    = GetComponentInParent <IObjectSeeker>();
     stateData       = new Dictionary <GathererState, dynamic>();
     utilityFunction = new UtilityEvaluatorFunctionMapper <ResourceType>(new Dictionary <ResourceType, IIncrementalFunction>()
     {
         {
             ResourceType.Food,
             new InverseWeightedUtility(new WeightedRegion[] {
                 new WeightedRegion(0, 10f),
                 new WeightedRegion(2, 1f)
             })
         },
         {
             ResourceType.Wood,
             new InverseWeightedUtility(new WeightedRegion[] {
                 new WeightedRegion(0, 10),
                 new WeightedRegion(2, 1f)
             })
         }
     });
 }