Esempio n. 1
0
 public Construction(BuildingType type, Settlement location, Date today)
 {
     _type = type;
     _location = location;
     _startDate = today;
     //_resourceRequirements = _type.RequirementsFor(location);
 }
Esempio n. 2
0
 public void ShowSettlement(Settlement settlement)
 {
     if(settlement == null) return;
     Visible = true;
     _settlement = settlement;
     _name.Text = settlement.Name;
     _buildButton.Text = "Build "+ BuildingTypes.AvailableFor(_settlement).FirstOrDefault()?.Name ?? "No building";
     _resourceScrollableContainer.Refresh(settlement.Province.Resources.OrderByDescending(r=>r.Level.Value).ToList());
 }
Esempio n. 3
0
 public static IEnumerable<BuildingType> AvailableFor(Settlement settlement)
 {
     Debug.Assert(_buildingTypes != null, "Building statuses not initialized");
     return
         _buildingTypes
             .Except(settlement.Buildings.Select(b => b.Type)) //Not already built
             .Where(type => (!type.ReplaceBuildings.Any() || type.ReplaceBuildings.Any(t=>settlement.Buildings.Select(b=>b.Type).Contains(t))))
             .Where(type => type.PreConditionsValidFor(settlement));
 }
Esempio n. 4
0
 public LandProvince(World world, Zone zone) : base(world, zone)
 {
     Name = NameGenerator.GetRandomProvinceName();
     Color = CustomColor.Random;
     Capital = new Settlement(world, this);
 }
Esempio n. 5
0
 public NewConstructionCommand(BuildingType buildingtype, Settlement settlement)
 {
     _buildingtype = buildingtype;
     _settlement = settlement;
 }
Esempio n. 6
0
 public LandProvince(World world, Zone zone) : base(world, zone)
 {
     Name    = NameGenerator.GetRandomProvinceName();
     Color   = CustomColor.Random;
     Capital = new Settlement(world, this);
 }
Esempio n. 7
0
 public bool PreConditionsValidFor(Settlement settlement)
 {
     return _preConditions.All(p => p.IsValid(settlement));
 }
Esempio n. 8
0
 internal int ManPowerRequirementsFor(Settlement location) => (int)_manpowerRequirement.For(location);
Esempio n. 9
0
 internal List<ResourceRequirement> ResourceRequirementsFor(Settlement location)
 {
     return _resourceRequirements.Select(kvp => new ResourceRequirement(kvp.Key, (int)kvp.Value.For(location))).ToList();
 }