예제 #1
0
파일: Construction.cs 프로젝트: ndech/Alpha
 public Construction(BuildingType type, Settlement location, Date today)
 {
     _type = type;
     _location = location;
     _startDate = today;
     //_resourceRequirements = _type.RequirementsFor(location);
 }
예제 #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());
 }
예제 #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));
 }
예제 #4
0
파일: LandProvince.cs 프로젝트: ndech/Alpha
 public LandProvince(World world, Zone zone) : base(world, zone)
 {
     Name = NameGenerator.GetRandomProvinceName();
     Color = CustomColor.Random;
     Capital = new Settlement(world, this);
 }
예제 #5
0
 public NewConstructionCommand(BuildingType buildingtype, Settlement settlement)
 {
     _buildingtype = buildingtype;
     _settlement = settlement;
 }
예제 #6
0
 public LandProvince(World world, Zone zone) : base(world, zone)
 {
     Name    = NameGenerator.GetRandomProvinceName();
     Color   = CustomColor.Random;
     Capital = new Settlement(world, this);
 }
예제 #7
0
파일: BuildingType.cs 프로젝트: ndech/Alpha
 public bool PreConditionsValidFor(Settlement settlement)
 {
     return _preConditions.All(p => p.IsValid(settlement));
 }
예제 #8
0
 internal int ManPowerRequirementsFor(Settlement location) => (int)_manpowerRequirement.For(location);
예제 #9
0
 internal List<ResourceRequirement> ResourceRequirementsFor(Settlement location)
 {
     return _resourceRequirements.Select(kvp => new ResourceRequirement(kvp.Key, (int)kvp.Value.For(location))).ToList();
 }