예제 #1
0
 public void InjectDependencies(
     IYieldGenerationLogic resourceGenerationLogic, CitySignals citySignals
     )
 {
     YieldGenerationLogic = resourceGenerationLogic;
     CitySignals          = citySignals;
 }
예제 #2
0
 public void InjectDependencies(
     IPopulationGrowthLogic growthLogic, IYieldGenerationLogic generationLogic,
     CitySignals citySignals
     )
 {
     GrowthLogic     = growthLogic;
     GenerationLogic = generationLogic;
     CitySignals     = citySignals;
 }
예제 #3
0
 public CivilizationYieldLogic(
     IPossessionRelationship <ICivilization, ICity> cityPossessionCanon,
     IYieldGenerationLogic resourceGenerationLogic,
     IUnitMaintenanceLogic unitMaintenanceLogic
     )
 {
     CityPossessionCanon  = cityPossessionCanon;
     ResourceYieldLogic   = resourceGenerationLogic;
     UnitMaintenanceLogic = unitMaintenanceLogic;
 }
 public WorkerDistributionLogic(
     IPopulationGrowthLogic growthLogic, IYieldGenerationLogic generationLogic,
     IPossessionRelationship <ICity, IBuilding> buildingCanon, IPossessionRelationship <ICity, IHexCell> tileCanon
     )
 {
     GrowthLogic             = growthLogic;
     GenerationLogic         = generationLogic;
     BuildingPossessionCanon = buildingCanon;
     CellPossessionCanon     = tileCanon;
 }
예제 #5
0
        /// <summary>
        /// Constructs a comparison that orders cells based on the total yield that slot is expected
        /// to make for the argued city.
        /// </summary>
        /// <param name="sourceCity">The city whose hypothetical yield is being considered</param>
        /// <param name="generationLogic">The IResourceGenerationLogic used to determine the yield for the argued city</param>
        /// <returns>A Comparison that'll sort IHexCells from least to most total yield</returns>
        public static Comparison <IHexCell> BuildTotalYieldComparisonAscending(
            ICity sourceCity, IYieldGenerationLogic generationLogic
            )
        {
            return(delegate(IHexCell firstCell, IHexCell secondCell) {
                var firstYield = generationLogic.GetYieldOfCellForCity(firstCell, sourceCity);
                var secondYield = generationLogic.GetYieldOfCellForCity(secondCell, sourceCity);

                return firstYield.Total.CompareTo(secondYield.Total);
            });
        }
        /// <summary>
        /// Constructs a comparison that orders slots based on the total yield that slot is expected
        /// to make for the argued city.
        /// </summary>
        /// <param name="sourceCity">The city whose hypothetical yield is being considered</param>
        /// <param name="generationLogic">The IResourceGenerationLogic used to determine the yield for the argued city</param>
        /// <returns>A Comparison that'll sort IWorkerSlots from least to most total yield</returns>
        public static Comparison <IWorkerSlot> BuildTotalYieldComparisonAscending(
            ICity sourceCity, IYieldGenerationLogic generationLogic
            )
        {
            return(delegate(IWorkerSlot firstSlot, IWorkerSlot secondSlot) {
                var firstYield = GetSlotYield(firstSlot, sourceCity, generationLogic);
                var secondYield = GetSlotYield(secondSlot, sourceCity, generationLogic);

                return firstYield.Total.CompareTo(secondYield.Total);
            });
        }
 public ProductionLogic(
     ICityConfig config, IYieldGenerationLogic generationLogic,
     IPossessionRelationship <ICity, IBuilding> buildingPossessionCanon,
     IPossessionRelationship <ICivilization, ICity> cityPossessionCanon,
     ISocialPolicyCanon socialPolicyCanon
     )
 {
     Config                  = config;
     GenerationLogic         = generationLogic;
     BuildingPossessionCanon = buildingPossessionCanon;
     CityPossessionCanon     = cityPossessionCanon;
     SocialPolicyCanon       = socialPolicyCanon;
 }
 private static YieldSummary GetSlotYield(
     IWorkerSlot slot, ICity city, IYieldGenerationLogic generationLogic
     )
 {
     if (slot.ParentCell != null)
     {
         return(generationLogic.GetYieldOfCellForCity(slot.ParentCell, city));
     }
     else
     {
         return(generationLogic.GetYieldOfBuildingSlotsForCity(slot.ParentBuilding, city));
     }
 }
 public BorderExpansionLogic(
     IHexGrid hexGrid, IPossessionRelationship <ICity, IHexCell> possessionCanon,
     ICityConfig config, IYieldGenerationLogic resourceGenerationLogic,
     IPossessionRelationship <IHexCell, ICity> cityLocationCanon,
     IBorderExpansionModifierLogic borderExpansionModifierLogic
     )
 {
     HexGrid                      = hexGrid;
     PossessionCanon              = possessionCanon;
     Config                       = config;
     YieldGenerationLogic         = resourceGenerationLogic;
     CityLocationCanon            = cityLocationCanon;
     BorderExpansionModifierLogic = borderExpansionModifierLogic;
 }
예제 #10
0
 public void InjectDependencies(
     IPopulationGrowthLogic growthLogic, IProductionLogic productionLogic,
     IYieldGenerationLogic resourceGenerationLogic, IBorderExpansionLogic expansionLogic,
     IPossessionRelationship <ICity, IHexCell> tilePossessionCanon,
     IWorkerDistributionLogic distributionLogic, ICityProductionResolver cityProductionResolver,
     CitySignals signals
     )
 {
     GrowthLogic          = growthLogic;
     ProductionLogic      = productionLogic;
     YieldGenerationLogic = resourceGenerationLogic;
     ExpansionLogic       = expansionLogic;
     TilePossessionCanon  = tilePossessionCanon;
     DistributionLogic    = distributionLogic;
     ProductionResolver   = cityProductionResolver;
     Signals = signals;
 }
예제 #11
0
        /// <summary>
        /// Constructs a comparison that orders slots based on their capacity to satisfy a particular
        /// ResourceFocusType for the argued city.
        /// </summary>
        /// <param name="sourceCity">The city whose hypothetical yield is being considered</param>
        /// <param name="focus">The ResourceFocusType to be maximized for</param>
        /// <param name="generationLogic">The IResourceGenerationLogic used to determine the yield for the argued city</param>
        /// <returns>A Comparison that'll sort IHexCells based on their usefulness to the argued focus</returns>
        public static Comparison <IHexCell> BuildComparisonAscending(
            ICity sourceCity, YieldFocusType focus, IYieldGenerationLogic generationLogic
            )
        {
            switch (focus)
            {
            case YieldFocusType.Food:       return(BuildYieldComparisonAscending(YieldType.Food, sourceCity, generationLogic));

            case YieldFocusType.Gold:       return(BuildYieldComparisonAscending(YieldType.Gold, sourceCity, generationLogic));

            case YieldFocusType.Production: return(BuildYieldComparisonAscending(YieldType.Production, sourceCity, generationLogic));

            case YieldFocusType.Culture:    return(BuildYieldComparisonAscending(YieldType.Culture, sourceCity, generationLogic));

            case YieldFocusType.Science:    return(BuildYieldComparisonAscending(YieldType.Science, sourceCity, generationLogic));

            case YieldFocusType.TotalYield: return(BuildTotalYieldComparisonAscending(sourceCity, generationLogic));

            default: return(null);
            }
        }
 public void InjectDependencies(
     IHexGrid grid, ICityConfig config, IUnitPositionCanon unitPositionCanon,
     ICombatExecuter combatExecuter, UIStateMachineBrain brain,
     IPopulationGrowthLogic growthLogic, IProductionLogic productionLogic,
     IYieldGenerationLogic resourceGenerationLogic, IGameCore gameCore,
     IPossessionRelationship <ICivilization, ICity> cityPossessionCanon,
     IPossessionRelationship <IHexCell, ICity> cityLocationCanon,
     [Inject(Id = "UI Animator")] Animator uiAnimator
     )
 {
     Grid                 = grid;
     Config               = config;
     UnitPositionCanon    = unitPositionCanon;
     CombatExecuter       = combatExecuter;
     Brain                = brain;
     GrowthLogic          = growthLogic;
     ProductionLogic      = productionLogic;
     YieldGenerationLogic = resourceGenerationLogic;
     GameCore             = gameCore;
     CityPossessionCanon  = cityPossessionCanon;
     CityLocationCanon    = cityLocationCanon;
     UIAnimator           = uiAnimator;
 }
예제 #13
0
 public void InjectDependencies(
     IHexCellSignalLogic signalLogic,
     IYieldGenerationLogic generationLogic,
     IPossessionRelationship <ICity, IHexCell> cellPossessionCanon,
     IPossessionRelationship <IHexCell, IResourceNode> resourceNodePositionCanon,
     IImprovementLocationCanon improvementLocationCanon,
     ICellYieldLogic cellResourceLogic,
     IGameCore gameCore,
     IVisibilityCanon visibilityCanon,
     IExplorationCanon explorationCanon,
     IEncampmentLocationCanon encampmentLocationCanon
     )
 {
     SignalLogic               = signalLogic;
     GenerationLogic           = generationLogic;
     CellPossessionCanon       = cellPossessionCanon;
     ResourceNodePositionCanon = resourceNodePositionCanon;
     ImprovementLocationCanon  = improvementLocationCanon;
     CellYieldLogic            = cellResourceLogic;
     GameCore                = gameCore;
     VisibilityCanon         = visibilityCanon;
     ExplorationCanon        = explorationCanon;
     EncampmentLocationCanon = encampmentLocationCanon;
 }
예제 #14
0
 public void InjectDependencies(IBorderExpansionLogic expansionLogic, IYieldGenerationLogic resourceGenerationLogic)
 {
     ExpansionLogic       = expansionLogic;
     YieldGenerationLogic = resourceGenerationLogic;
 }
예제 #15
0
        /// <summary>
        /// Constructs a comparison that orders cells based on the amount of a particular
        /// resource type they would generate for the argued city, with other considerations
        /// in case of ties.
        /// </summary>
        /// <remarks>
        /// The effective yield is ordered from the smallest expected yield to the largest.
        /// Ties are broken first by the amount of food the resources yield, then by total
        /// yield on the tile. Both tiebreakers are organized in ascending order
        /// </remarks>
        /// <param name="sourceCity">The city whose hypothetical yield is being considered</param>
        /// <param name="focusedResource">The ResourceType to be maximized</param>
        /// <param name="generationLogic">The IResourceGenerationLogic used to determine the yield for the argued city</param>
        /// <returns>A Comparison that'll sort IHexCells from least to most yield of the focused resource</returns>
        public static Comparison <IHexCell> BuildFocusedComparisonAscending(ICity sourceCity,
                                                                            YieldType focusedResource, IYieldGenerationLogic generationLogic)
        {
            return(delegate(IHexCell firstCell, IHexCell secondCell) {
                var firstYield = generationLogic.GetYieldOfCellForCity(firstCell, sourceCity);
                var secondYield = generationLogic.GetYieldOfCellForCity(secondCell, sourceCity);

                var focusComparison = firstYield[focusedResource].CompareTo(secondYield[focusedResource]);
                if (focusComparison == 0)
                {
                    focusComparison = firstYield[YieldType.Food].CompareTo(secondYield[YieldType.Food]);
                }
                if (focusComparison == 0)
                {
                    focusComparison = firstYield.Total.CompareTo(secondYield.Total);
                }

                return focusComparison;
            });
        }
        /// <summary>
        /// Constructs a comparison that orders slots based on the amount of a particular
        /// resource type they generate for the argued city.
        /// </summary>
        /// <remarks>
        /// The effective yield is ordered from the smallest expected yield to the largest.
        /// Ties are broken first by the amount of food the resources yield, then by total
        /// yield on the tile. Both tiebreakers are organized in ascending order
        /// </remarks>
        /// <param name="sourceCity">The city whose hypothetical yield is being considered</param>
        /// <param name="focusedResource">The ResourceType to be maximized</param>
        /// <param name="generationLogic">The IResourceGenerationLogic used to determine the yield for the argued city</param>
        /// <returns>A Comparison that'll sort IWorkerSlots from least to most yield of the focused resource</returns>
        public static Comparison <IWorkerSlot> BuildFocusedComparisonAscending(ICity sourceCity,
                                                                               YieldType focusedResource, IYieldGenerationLogic generationLogic)
        {
            return(delegate(IWorkerSlot firstSlot, IWorkerSlot secondSlot) {
                var firstYield = GetSlotYield(firstSlot, sourceCity, generationLogic);
                var secondYield = GetSlotYield(secondSlot, sourceCity, generationLogic);

                var focusComparison = firstYield[focusedResource].CompareTo(secondYield[focusedResource]);
                if (focusComparison == 0)
                {
                    focusComparison = firstYield[YieldType.Food].CompareTo(secondYield[YieldType.Food]);
                }
                if (focusComparison == 0)
                {
                    focusComparison = firstYield.Total.CompareTo(secondYield.Total);
                }

                return focusComparison;
            });
        }