public void TestRotations() { Building b = new Building("test"); b.Size = Vector2.One * 3; b.AddCraftingCategory("test"); b.ProductionSpeed = 2; b.IngredientCount = 3; b.AddFluidBox(new FluidBox(true, Vector2.Zero)); Recipe r = new Recipe("test"); r.CraftingCategory = "test"; var phys1 = new ProductionBuilding(r, 1, b, Vector2.Zero, BuildingRotation.North); var phys2 = new ProductionBuilding(r, 1, b, Vector2.Zero, BuildingRotation.East); var phys3 = new ProductionBuilding(r, 1, b, Vector2.Zero, BuildingRotation.South); var phys4 = new ProductionBuilding(r, 1, b, Vector2.Zero, BuildingRotation.West); Assert.AreEqual(Vector2.Zero, phys1.FluidBoxes.First().Position); Assert.AreEqual(new Vector2(2, 0), phys2.FluidBoxes.First().Position); Assert.AreEqual(new Vector2(2, 2), phys3.FluidBoxes.First().Position); Assert.AreEqual(new Vector2(0, 2), phys4.FluidBoxes.First().Position); }
public int calculateUpgradeCost(int currentCost, ProductionBuilding buildingType) { int result = 0; switch (buildingType) { case ProductionBuilding.Shack: result = (int)(currentCost * c_shackUpgradeMultiplier); break; case ProductionBuilding.House: result = (int)(currentCost * c_houseUpgradeMultiplier); break; case ProductionBuilding.Villa: result = (int)(currentCost * c_villaUpgradeMultiplier); break; case ProductionBuilding.Scrapyard: result = (int)(currentCost * c_scrapUpgradeMultiplier); break; case ProductionBuilding.Ironmine: result = (int)(currentCost * c_ironMineUpgradeMultiplier); break; case ProductionBuilding.CommandCenter: result = (int)(currentCost * c_ccUpgradeMultiplier); break; } return(result); }
public int calculateCashProduction(int level, ProductionBuilding buildingType) { int result = 0; switch (buildingType) { case ProductionBuilding.Shack: result = c_baseShackProduction * level; break; case ProductionBuilding.House: result = c_baseHouseProduction * level; break; case ProductionBuilding.Villa: result = c_baseVillaProduction * level; break; } return(result); }
public int calculateUpgradeCost(int currentCost, ProductionBuilding buildingType) { int result = 0; switch (buildingType) { case ProductionBuilding.Shack: result = (int)(currentCost * c_shackUpgradeMultiplier); break; case ProductionBuilding.House: result = (int)(currentCost * c_houseUpgradeMultiplier); break; case ProductionBuilding.Villa: result = (int)(currentCost * c_villaUpgradeMultiplier); break; } return(result); }
public override void OnStateEnter(ProductionBuilding productionBuilding) { base.OnStateEnter(productionBuilding); m_targetBuilding.ProductionBuildingView.SetProductionUIActive(true); }
public void AddProductionBuildingItem(ProductionBuilding _pb) { m_pqu.AddToQueue(_pb); }
public void CloseUI() { ClearObjects(); MyUI.SetActive(false); currentBuilding = null; }
public ProductionBuilding _building; //The building offering the job //Constructor. Call new Job(this) from the Building script to instanciate a job public Job(ProductionBuilding building) { _building = building; }
private void Awake() { _productionBuilding = GetComponent <ProductionBuilding>(); }
public void Employ(Job job) { Workplace = job.Workplace; _employed = true; MoveToWork(Home.Tile); }
static Buildings() { FishermansHut = new ProductionBuilding { Key = "FishermansHut", DisplayName = "Fischerhütte", Restrictions = BuildingRestrictions.Coast, UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Peasants), Input = new[] { new BuildingInput(WaterResources.Fishes) }, Output = new BuildingOutput(ConsumableGoods.Fishes, 2), ActiveCostPerMinute = 15, InactiveCostPerMinute = 5 }; SpiceFarm = new ProductionBuilding { Key = "SpiceFarm", DisplayName = "Gewürzplantage", UnlockThreshold = new PopulationRequirement(145, PopulationGroups.Nomads), Input = new[] { new BuildingInput(Fertilities.Spices) }, Output = new BuildingOutput(ConsumableGoods.Spices, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; Bakery = new ProductionBuilding { Key = "Bakery", DisplayName = "Backhaus", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Flour) }, Output = new BuildingOutput(ConsumableGoods.Bread, 4), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; ButchersShop = new ProductionBuilding { Key = "ButchersShop", DisplayName = "Schlachterei", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Cattle), new BuildingInput(RawMaterials.Salt) }, Output = new BuildingOutput(ConsumableGoods.Meat, 2.5), ActiveCostPerMinute = 50, InactiveCostPerMinute = 25 }; CiderFarm = new ProductionBuilding { Key = "CiderFarm", DisplayName = "Mosthof", UnlockThreshold = new PopulationRequirement(60, PopulationGroups.Peasants), Input = new[] { new BuildingInput(Fertilities.Cider) }, Output = new BuildingOutput(ConsumableGoods.Cider, 1.5), ActiveCostPerMinute = 15, InactiveCostPerMinute = 5 }; MonasteryBrewery = new ProductionBuilding { Key = "MonasteryBrewery", DisplayName = "Klosterbrauerei", UnlockThreshold = new PopulationRequirement(510, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Herbs), new BuildingInput(RawMaterials.Wheat) }, Output = new BuildingOutput(ConsumableGoods.Beer, 1.5), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; WinePress = new ProductionBuilding { Key = "WinePress", DisplayName = "Kelterhaus", UnlockThreshold = new PopulationRequirement(1500, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Barrels), new BuildingInput(RawMaterials.Grapes) }, Output = new BuildingOutput(ConsumableGoods.Wine, 2), ActiveCostPerMinute = 50, InactiveCostPerMinute = 25 }; WeaversHut = new ProductionBuilding { Key = "WeaversHut", DisplayName = "Weberhütte", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Citizens), Input = new[] { new BuildingInput(RawMaterials.Hemp) }, Output = new BuildingOutput(ConsumableGoods.LinenGarments, 2), ActiveCostPerMinute = 25, InactiveCostPerMinute = 10 }; Tannery = new ProductionBuilding { Key = "Tannery", DisplayName = "Gerberei", Restrictions = BuildingRestrictions.River, UnlockThreshold = new PopulationRequirement(690, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Salt), new BuildingInput(RawMaterials.AnimalHides) }, Output = new BuildingOutput(ConsumableGoods.LeatherJerkins, 4), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; FurriersWorkshop = new ProductionBuilding { Key = "FurriersWorkshop", DisplayName = "Kürschnerei", Restrictions = BuildingRestrictions.River, UnlockThreshold = new PopulationRequirement(950, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Furs), new BuildingInput(RawMaterials.Salt) }, Output = new BuildingOutput(ConsumableGoods.FurCoats, 2.5), ActiveCostPerMinute = 90, InactiveCostPerMinute = 45 }; SilkWeavingMill = new ProductionBuilding { Key = "SilkWeavingMill", DisplayName = "Seidenweberei", UnlockThreshold = new PopulationRequirement(4000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Silk), new BuildingInput(RawMaterials.Gold) }, Output = new BuildingOutput(ConsumableGoods.BrocadeCoats, 3), ActiveCostPerMinute = 80, InactiveCostPerMinute = 40 }; PrintingHouse = new ProductionBuilding { Key = "PrintingHouse", DisplayName = "Druckerei", UnlockThreshold = new PopulationRequirement(940, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Paper) }, Output = new BuildingOutput(ConsumableGoods.Books, 3), ActiveCostPerMinute = 50, InactiveCostPerMinute = 25 }; RedsmithsWorkshop = new ProductionBuilding { Key = "RedsmithsWorkshop", DisplayName = "Feinschmiede", UnlockThreshold = new PopulationRequirement(3000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Brass), new BuildingInput(RawMaterials.Candles) }, Output = new BuildingOutput(ConsumableGoods.Candlesticks, 2), ActiveCostPerMinute = 60, InactiveCostPerMinute = 30 }; OpticiansWorkshop = new ProductionBuilding { Key = "OpticiansWorkshop", DisplayName = "Brillenmacherei", UnlockThreshold = new PopulationRequirement(2200, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Quartz), new BuildingInput(RawMaterials.Brass) }, Output = new BuildingOutput(ConsumableGoods.Glasses, 2), ActiveCostPerMinute = 40, InactiveCostPerMinute = 20 }; DatePlantation = new ProductionBuilding { Key = "DatePlantation", DisplayName = "Dattelplantage", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Nomads), Input = new[] { new BuildingInput(Fertilities.Dates) }, Output = new BuildingOutput(ConsumableGoods.Dates, 3), ActiveCostPerMinute = 45, InactiveCostPerMinute = 20 }; GoatFarm = new ProductionBuilding { Key = "GoatFarm", DisplayName = "Ziegenfarm", UnlockThreshold = new PopulationRequirement(145, PopulationGroups.Nomads), Input = new BuildingInput[0], Output = new BuildingOutput(ConsumableGoods.Milk, 1.5), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; CarpetWorkshop = new ProductionBuilding { Key = "CarpetWorkshop", DisplayName = "Teppichknüpferei", UnlockThreshold = new PopulationRequirement(295, PopulationGroups.Nomads), Input = new[] { new BuildingInput(RawMaterials.Indigo), new BuildingInput(RawMaterials.Silk) }, Output = new BuildingOutput(ConsumableGoods.Carpets, 1.5), ActiveCostPerMinute = 60, InactiveCostPerMinute = 30 }; RoastingHouse = new ProductionBuilding { Key = "RoastingHouse", DisplayName = "Rösterei", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Envoys), Input = new[] { new BuildingInput(RawMaterials.CoffeeBeans) }, Output = new BuildingOutput(ConsumableGoods.Coffee, 1), ActiveCostPerMinute = 45, InactiveCostPerMinute = 25 }; PearlWorkshop = new ProductionBuilding { Key = "PearlWorkshop", DisplayName = "Perlenknüpfer", UnlockThreshold = new PopulationRequirement(1040, PopulationGroups.Envoys), Input = new[] { new BuildingInput(RawMaterials.Pearls) }, Output = new BuildingOutput(ConsumableGoods.PearlNecklaces, 1), ActiveCostPerMinute = 70, InactiveCostPerMinute = 35 }; Perfumery = new ProductionBuilding { Key = "Perfumery", DisplayName = "Duftmischer", UnlockThreshold = new PopulationRequirement(2600, PopulationGroups.Envoys), Input = new[] { new BuildingInput(RawMaterials.RoseOil) }, Output = new BuildingOutput(ConsumableGoods.Perfume, 1), ActiveCostPerMinute = 60, InactiveCostPerMinute = 30 }; ConfectionersWorkshop = new ProductionBuilding { Key = "ConfectionersWorkshop", DisplayName = "Zuckerbäckerei", UnlockThreshold = new PopulationRequirement(4360, PopulationGroups.Envoys), Input = new[] { new BuildingInput(RawMaterials.Sugar), new BuildingInput(RawMaterials.Almonds) }, Output = new BuildingOutput(ConsumableGoods.Marzipan, 4), ActiveCostPerMinute = 100, InactiveCostPerMinute = 50 }; Mill = new ProductionBuilding { Key = "Mill", DisplayName = "Mühle", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Wheat) }, Output = new BuildingOutput(RawMaterials.Flour, 4), ActiveCostPerMinute = 30, InactiveCostPerMinute = 10 }; CropFarm = new ProductionBuilding { Key = "CropFarm", DisplayName = "Weizenfarm", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Patricians), Input = new[] { new BuildingInput(Fertilities.Wheat) }, Output = new BuildingOutput(RawMaterials.Wheat, 2), ActiveCostPerMinute = 5, InactiveCostPerMinute = 0 }; CattleFarm = new ProductionBuilding { Key = "CattleFarm", DisplayName = "Rindefarm", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Noblemen), Input = new BuildingInput[0], Output = new BuildingOutput(RawMaterials.Cattle, 1.25), ActiveCostPerMinute = 25, InactiveCostPerMinute = 10 }; MonasteryGarden = new ProductionBuilding { Key = "MonasteryGarden", DisplayName = "Klostergarten", UnlockThreshold = new PopulationRequirement(510, PopulationGroups.Patricians), Input = new[] { new BuildingInput(Fertilities.Herbs) }, Output = new BuildingOutput(RawMaterials.Herbs, 2), ActiveCostPerMinute = 10, InactiveCostPerMinute = 0 }; Vineyard = new ProductionBuilding { Key = "Vineyard", DisplayName = "Weingut", UnlockThreshold = new PopulationRequirement(1500, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(Fertilities.Grapes) }, Output = new BuildingOutput(RawMaterials.Grapes, 0.66), ActiveCostPerMinute = 25, InactiveCostPerMinute = 15 }; BarrelCooperage = new ProductionBuilding { Key = "BarrelCooperage", DisplayName = "Fassküferei", UnlockThreshold = new PopulationRequirement(1500, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Iron), new BuildingInput(ConstructionMaterials.Wood) }, Output = new BuildingOutput(RawMaterials.Barrels, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; HempPlantation = new ProductionBuilding { Key = "HempPlantation", DisplayName = "Hanfplantage", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Citizens), Input = new[] { new BuildingInput(Fertilities.Hemp) }, Output = new BuildingOutput(RawMaterials.Hemp, 1), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; PigFarm = new ProductionBuilding { Key = "PigFarm", DisplayName = "Schweinezucht", UnlockThreshold = new PopulationRequirement(690, PopulationGroups.Patricians), Input = new BuildingInput[0], Output = new BuildingOutput(RawMaterials.AnimalHides, 2), ActiveCostPerMinute = 15, InactiveCostPerMinute = 10 }; TrappersLodge = new ProductionBuilding { Key = "TrappersLodge", DisplayName = "Pelztierjagdhütte", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(950, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(MountainResources.FurAnimals) }, Output = new BuildingOutput(RawMaterials.Furs, 2.50), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; SilkPlantation = new ProductionBuilding { Key = "SilkPlantation", DisplayName = "Seidenplantage", UnlockThreshold = new PopulationRequirement(295, PopulationGroups.Nomads), Input = new[] { new BuildingInput(Fertilities.Silk) }, Output = new BuildingOutput(RawMaterials.Silk, 1.5), ActiveCostPerMinute = 25, InactiveCostPerMinute = 10 }; IndigoFarm = new ProductionBuilding { Key = "IndigoFarm", DisplayName = "Indigoplantage", UnlockThreshold = new PopulationRequirement(295, PopulationGroups.Nomads), Input = new[] { new BuildingInput(Fertilities.Indigo) }, Output = new BuildingOutput(RawMaterials.Indigo, 1.5), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; PaperMill = new ProductionBuilding { Key = "PaperMill", DisplayName = "Papiermühle", Restrictions = BuildingRestrictions.River, UnlockThreshold = new PopulationRequirement(940, PopulationGroups.Patricians), Input = new[] { new BuildingInput(ConstructionMaterials.Wood) }, Output = new BuildingOutput(RawMaterials.Paper, 3), ActiveCostPerMinute = 50, InactiveCostPerMinute = 25 }; SaltWorks = new ProductionBuilding { Key = "SaltWorks", DisplayName = "Saline", UnlockThreshold = new PopulationRequirement(690, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Brine) }, Output = new BuildingOutput(RawMaterials.Salt, 4), ActiveCostPerMinute = 25, InactiveCostPerMinute = 12 }; CandlemakersWorkshop = new ProductionBuilding { Key = "CandlemakersWorkshop", DisplayName = "Lichtzieherei", UnlockThreshold = new PopulationRequirement(3000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.Beeswax), new BuildingInput(RawMaterials.Hemp) }, Output = new BuildingOutput(RawMaterials.Candles, 1.33), ActiveCostPerMinute = 40, InactiveCostPerMinute = 20 }; Apiary = new ProductionBuilding { Key = "Apiary", DisplayName = "Imkerei", UnlockThreshold = new PopulationRequirement(3000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(Fertilities.Bees) }, Output = new BuildingOutput(RawMaterials.Beeswax, 0.67), ActiveCostPerMinute = 15, InactiveCostPerMinute = 10 }; CoffeePlantation = new ProductionBuilding { Key = "CoffeePlantation", DisplayName = "Kaffeeplantage", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Envoys), Input = new[] { new BuildingInput(Fertilities.Coffee) }, Output = new BuildingOutput(RawMaterials.CoffeeBeans, 1), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; RoseNursery = new ProductionBuilding { Key = "RoseNursery", DisplayName = "Rosenplantage", UnlockThreshold = new PopulationRequirement(2600, PopulationGroups.Envoys), Input = new[] { new BuildingInput(Fertilities.Roses) }, Output = new BuildingOutput(RawMaterials.RoseOil, 0.5), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; SugarCanePlantation = new ProductionBuilding { Key = "SugarCanePlantation", DisplayName = "Zuckerrohrplantage", UnlockThreshold = new PopulationRequirement(4360, PopulationGroups.Envoys), Input = new[] { new BuildingInput(Fertilities.SugarCanes) }, Output = new BuildingOutput(RawMaterials.SugarCane, 2), ActiveCostPerMinute = 35, InactiveCostPerMinute = 15 }; SugarMill = new ProductionBuilding { Key = "SugarMill", DisplayName = "Zuckermühle", UnlockThreshold = new PopulationRequirement(4360, PopulationGroups.Envoys), Input = new[] { new BuildingInput(RawMaterials.SugarCane) }, Output = new BuildingOutput(RawMaterials.Sugar, 4), ActiveCostPerMinute = 40, InactiveCostPerMinute = 20 }; AlmondPlantation = new ProductionBuilding { Key = "AlmondPlantation", DisplayName = "Mandelfarm", UnlockThreshold = new PopulationRequirement(4360, PopulationGroups.Envoys), Input = new[] { new BuildingInput(Fertilities.Almonds) }, Output = new BuildingOutput(RawMaterials.Almonds, 2), ActiveCostPerMinute = 15, InactiveCostPerMinute = 5 }; ClayPit = new ProductionBuilding { Key = "ClayPit", DisplayName = "Tongrube", UnlockThreshold = new PopulationRequirement(440, PopulationGroups.Nomads), Input = new[] { new BuildingInput(Fertilities.Clay) }, Output = new BuildingOutput(RawMaterials.Clay, 1.2), ActiveCostPerMinute = 15, InactiveCostPerMinute = 5 }; MosaicWorkshop = new ProductionBuilding { Key = "MosaicWorkshop", DisplayName = "Mosaikmacherei", UnlockThreshold = new PopulationRequirement(440, PopulationGroups.Nomads), Input = new[] { new BuildingInput(RawMaterials.Quartz), new BuildingInput(RawMaterials.Clay) }, Output = new BuildingOutput(ConstructionMaterials.Mosaic, 2.4), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; ToolmakersWorkshop = new ProductionBuilding { Key = "ToolmakersWorkshop", DisplayName = "Werkzeugschmiede", UnlockThreshold = new PopulationRequirement(240, PopulationGroups.Citizens), Input = new[] { new BuildingInput(RawMaterials.Iron) }, Output = new BuildingOutput(ConstructionMaterials.Tools, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; Ropeyard = new ProductionBuilding { Key = "Ropeyard", DisplayName = "Seilerei", UnlockThreshold = new PopulationRequirement(240, PopulationGroups.Citizens), Input = new[] { new BuildingInput(RawMaterials.Hemp) }, Output = new BuildingOutput(RawMaterials.Ropes, 2), ActiveCostPerMinute = 40, InactiveCostPerMinute = 20 }; GlassSmelter = new ProductionBuilding { Key = "GlassSmelter", DisplayName = "Glasmacher", UnlockThreshold = new PopulationRequirement(510, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Quartz), new BuildingInput(RawMaterials.Potash) }, Output = new BuildingOutput(ConstructionMaterials.Glass, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; IronSmelter = new ProductionBuilding { Key = "IronSmelter", DisplayName = "Eisenschmelze", UnlockThreshold = new PopulationRequirement(240, PopulationGroups.Citizens), Input = new[] { new BuildingInput(RawMaterials.IronOre), new BuildingInput(RawMaterials.Coal) }, Output = new BuildingOutput(RawMaterials.Iron, 2), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; GoldSmelter = new ProductionBuilding { Key = "GoldSmelter", DisplayName = "Goldschmelze", UnlockThreshold = new PopulationRequirement(4000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.GoldOre), new BuildingInput(RawMaterials.Coal) }, Output = new BuildingOutput(RawMaterials.Gold, 1.5), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; CopperSmelter = new ProductionBuilding { Key = "CopperSmelter", DisplayName = "Kupferschmelze", UnlockThreshold = new PopulationRequirement(2200, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(RawMaterials.CopperOre), new BuildingInput(RawMaterials.Coal) }, Output = new BuildingOutput(RawMaterials.Brass, 1.33), ActiveCostPerMinute = 40, InactiveCostPerMinute = 25 }; SaltMine = new ProductionBuilding { Key = "SaltMine", DisplayName = "Salzmine", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(690, PopulationGroups.Patricians), Input = new[] { new BuildingInput(MountainResources.Brine) }, Output = new BuildingOutput(RawMaterials.Brine, 4), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; OreMine = new ProductionBuilding { Key = "OreMine", DisplayName = "Eisenerzmine", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(240, PopulationGroups.Citizens), Input = new[] { new BuildingInput(MountainResources.IronOre) }, Output = new BuildingOutput(RawMaterials.IronOre, 2), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; GoldMine = new ProductionBuilding { Key = "GoldMine", DisplayName = "Goldmine", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(4000, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(MountainResources.GoldOre) }, Output = new BuildingOutput(RawMaterials.GoldOre, 1.33), ActiveCostPerMinute = 50, InactiveCostPerMinute = 30 }; CopperMine = new ProductionBuilding { Key = "CopperMine", DisplayName = "Kupfermine", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(2200, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(MountainResources.CopperOre) }, Output = new BuildingOutput(RawMaterials.CopperOre, 1.33), ActiveCostPerMinute = 40, InactiveCostPerMinute = 25 }; CoalMine = new ProductionBuilding { Key = "CoalMine", DisplayName = "Kohlemine", Restrictions = BuildingRestrictions.Mountain, UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(MountainResources.Coal) }, Output = new BuildingOutput(RawMaterials.Coal, 4), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; QuartzQuarry = new ProductionBuilding { Key = "QuartzQuarry", DisplayName = "Quarzbruch", UnlockThreshold = new PopulationRequirement(440, PopulationGroups.Nomads), Input = new[] { new BuildingInput(MountainResources.Quartz) }, Output = new BuildingOutput(RawMaterials.Quartz, 1.33), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; LumberjacksHut = new ProductionBuilding { Key = "LumberjacksHut", DisplayName = "Holzfällerhütte", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Peasants), Input = new[] { new BuildingInput(Fertilities.Forest) }, Output = new BuildingOutput(ConstructionMaterials.Wood, 1.5), ActiveCostPerMinute = 5, InactiveCostPerMinute = 0 }; StonemasonsHut = new ProductionBuilding { Key = "StonemasonsHut", DisplayName = "Steinmetz", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Citizens), Input = new[] { new BuildingInput(MountainResources.Quarry) }, Output = new BuildingOutput(ConstructionMaterials.Stone, 2), ActiveCostPerMinute = 20, InactiveCostPerMinute = 10 }; CharcoalBurnersHut = new ProductionBuilding { Key = "CharcoalBurnersHut", DisplayName = "Köhlerhütte", UnlockThreshold = new PopulationRequirement(240, PopulationGroups.Citizens), Input = new[] { new BuildingInput(Fertilities.Forest) }, Output = new BuildingOutput(RawMaterials.Coal, 2), ActiveCostPerMinute = 10, InactiveCostPerMinute = 0 }; PearlFishersHut = new ProductionBuilding { Key = "PearlFishersHut", DisplayName = "Perlentaucher", Restrictions = BuildingRestrictions.Coast, UnlockThreshold = new PopulationRequirement(1040, PopulationGroups.Envoys), Input = new[] { new BuildingInput(WaterResources.Reef) }, Output = new BuildingOutput(RawMaterials.Pearls, 1), ActiveCostPerMinute = 40, InactiveCostPerMinute = 20 }; ForestGlassworks = new ProductionBuilding { Key = "ForestGlassworks", DisplayName = "Waldglashütte", UnlockThreshold = new PopulationRequirement(510, PopulationGroups.Patricians), Input = new[] { new BuildingInput(Fertilities.Forest) }, Output = new BuildingOutput(RawMaterials.Potash, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; CannonFoundry = new ProductionBuilding { Key = "CannonFoundry", DisplayName = "Kanonenschmiede", UnlockThreshold = new PopulationRequirement(950, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(ConstructionMaterials.Wood), new BuildingInput(RawMaterials.Iron) }, Output = new BuildingOutput(WarfareMaterials.Cannons, 1), ActiveCostPerMinute = 100, InactiveCostPerMinute = 50 }; ProvisionHouse = new ProductionBuilding { Key = "ProvisionHouse", DisplayName = "Proviantmagazin", UnlockThreshold = new PopulationRequirement(950, PopulationGroups.Noblemen), Input = new BuildingInput[0], Output = new BuildingOutput(WarfareMaterials.Provisions, 5.0), ActiveCostPerMinute = 15, InactiveCostPerMinute = 0 / 23.0 // Production cycle is 23 sec }; WarMachinesWorkshop = new ProductionBuilding { Key = "WarMachinesWorkshop", DisplayName = "Kriegsmaschinenwerkstatt", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Noblemen), Input = new[] { new BuildingInput(ConstructionMaterials.Wood), new BuildingInput(RawMaterials.Ropes) }, Output = new BuildingOutput(WarfareMaterials.WarMachines, 1.5), ActiveCostPerMinute = 60, InactiveCostPerMinute = 30 }; WeaponSmithy = new ProductionBuilding { Key = "WeaponSmithy", DisplayName = "Waffenschmiede", UnlockThreshold = new PopulationRequirement(1, PopulationGroups.Patricians), Input = new[] { new BuildingInput(RawMaterials.Iron) }, Output = new BuildingOutput(WarfareMaterials.Weapons, 2), ActiveCostPerMinute = 30, InactiveCostPerMinute = 15 }; }
public Job(ProductionBuilding workPlace) { Workplace = workPlace; }
public Job(Worker worker, ProductionBuilding workPlace) { Workplace = workPlace; Worker = worker; }
public void MenuOpen(ProductionBuilding b) { MenuOpen(); }
public bool tryCollectionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, ProductionBuilding buildingType) { int idx = Convert.ToInt32(product.Title.Substring(0, 1)); Structure structure = getStructureByVehicleID(computer._id); //Sanity if (structure == null) { return(false); } int level = structure._productionLevel; int cash = calculateProduction(level, buildingType); int cashNextLevel = calculateProduction(level + 1, buildingType); int upgradeNextLevel = calculateUpgradeCost(structure._upgradeCost, buildingType); switch (idx) { //1 - Collect case 1: { //Are we ready? if (!IsProductionReady(structure)) { player.sendMessage(0, "&This building is not ready for collection yet."); return(false); } //Produce! structure.produce(player); } break; //2 - Upgrade (100 Iron) case 2: { if (player.getInventoryAmount(2027) < structure._upgradeCost) { player.sendMessage(-1, "&You do not have sufficient iron to upgrade this building"); return(false); } player.inventoryModify(2027, -structure._upgradeCost); player.syncState(); //Up the cost for the next level structure._upgradeCost = upgradeNextLevel; structure._productionLevel++; structure._productionQuantity = cashNextLevel; player.sendMessage(0, String.Format("&Structure upgraded, Next collection: {0}", structure._productionQuantity)); } break; //3 More Info case 3: { player.sendMessage(0, String.Format("$Building Info:")); int repairCost = calculateRepairCost(structure._vehicle); player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost)); player.sendMessage(0, String.Format("& --- Current Level: {0}", structure._productionLevel)); player.sendMessage(0, String.Format("& --- Upgrade Cost for next level: {0} Iron", structure._upgradeCost)); player.sendMessage(0, String.Format("& --- Next Collection amount: {0}", structure._productionQuantity)); player.sendMessage(0, String.Format("& --- Next Level Collection amount: {0}", cashNextLevel)); TimeSpan remaining = _baseScript.timeTo(structure._nextProduction.TimeOfDay); player.sendMessage(0, String.Format("Next collection ready in {0} Hour(s) & {1} minute(s)", remaining.Hours, remaining.Minutes)); } break; //14 - Sell case 14: { player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity); player.syncState(); player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity)); structure.destroyed(structure._vehicle, player); structure._vehicle.destroy(false); } break; //15 - Repair case 15: { int repairCost = calculateRepairCost(structure._vehicle); if (player.getInventoryAmount(2026) < repairCost) { player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building"); return(false); } structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints; player.inventoryModify(2026, -repairCost); player.sendMessage(0, "Structure repaired"); player.syncState(); } break; } return(false); }
protected override void Initialize() { m_targetBuilding = CityManager.Instance.SelectedProductionBuilding; }
public void Fire() { Workplace = null; _employed = false; }
public void AddProductionBuildingToList(ProductionBuilding _pb) { UIManager.Instance.AddProductionBuildingItem(_pb); m_ProductionBuildWaitingList.Add(_pb.m_Production); }
public static IEnumerable <RoutingCoordinate> BuildingToPipes(IStep step, SolutionParameters parameters, Item item) { var sourceStep = step as SourceStep; if (sourceStep != null) { var pos = parameters.SourcePositions[sourceStep]; var rotation = InwardDirectionForEdge(pos, new Vector2(parameters.Width, parameters.Height)); yield return(new RoutingCoordinate(pos, RoutingCoordinate.CoordinateType.PipeToGround, rotation)); } var sinkStep = step as SinkStep; if (sinkStep != null) { var pos = parameters.SinkPositions[sinkStep]; var rotation = InwardDirectionForEdge(pos, new Vector2(parameters.Width, parameters.Height)); yield return(new RoutingCoordinate(pos, RoutingCoordinate.CoordinateType.PipeToGround, rotation)); } var productionStep = step as ProductionStep; if (productionStep != null) { List <FluidBox> boxes; List <ItemAmount> items; var productionBuilding = new ProductionBuilding(productionStep.Recipe, productionStep.Amount, productionStep.Building, parameters.BuildingPositions[productionStep].Item1, parameters.BuildingPositions[productionStep].Item2); if (productionStep.Recipe.Ingredients.Where((i) => i.Item == item).Any()) { boxes = productionBuilding.FluidBoxes.Where((b) => !b.IsOutput).ToList(); items = productionBuilding.Recipe.Ingredients.ToList(); } else { boxes = productionBuilding.FluidBoxes.Where((b) => b.IsOutput).ToList(); items = productionBuilding.Recipe.Results.ToList(); } for (int i = 0; i < boxes.Count; i++) { var matchingIngredient = items[Math.Min(i, items.Count - 1)]; if (matchingIngredient.Item != item) { continue; } var box = boxes[i]; for (int d = 0; d < 4; d++) { var dir = (BuildingRotation)d; var offsetDir = box.Position + dir.ToVector(); if (offsetDir.Clamp(productionBuilding.Size - Vector2.One) == offsetDir) { yield return(new RoutingCoordinate(offsetDir + productionBuilding.Position, RoutingCoordinate.CoordinateType.PipeToGround, dir.Invert())); } } } } }
public bool tryResidentialMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, ProductionBuilding buildingType) { int idx = Convert.ToInt32(product.Title.Substring(0, 1)); Structure structure = getStructureByVehicleID(computer._id); //Sanity if (structure == null) { return(false); } int level = structure._productionLevel; int cash = calculateCashProduction(level, buildingType); int cashNextLevel = calculateCashProduction(level + 1, buildingType); int upgradeNextLevel = calculateUpgradeCost(structure._upgradeCost, buildingType); switch (idx) { //1 - Collect case 1: { //Are we ready? if (!IsProductionReady(structure)) { player.sendMessage(0, "&This building is not ready for collection yet."); return(false); } //Produce! structure.produce(player); } break; //2 - Upgrade (100 Iron) case 2: { if (player.getInventoryAmount(2027) < structure._upgradeCost) { player.sendMessage(-1, "&You do not have sufficient iron to upgrade this building"); return(false); } player.inventoryModify(2027, -structure._upgradeCost); player.syncState(); //Up the cost for the next level structure._upgradeCost = upgradeNextLevel; structure._productionLevel++; structure._productionQuantity = cashNextLevel; player.sendMessage(0, String.Format("&Structure upgraded, Next collection: ${0}", structure._productionQuantity)); } break; //3 More Info case 3: { player.sendMessage(0, String.Format("&Building Info:")); player.sendMessage(0, String.Format("Current Level: {0}", structure._productionLevel)); player.sendMessage(0, String.Format("Upgrade Cost for next level: {0} Iron", structure._upgradeCost)); player.sendMessage(0, String.Format("Next Collection amount: ${0}", structure._productionQuantity)); player.sendMessage(0, String.Format("Next Level Collection amount: ${0}", cashNextLevel)); TimeSpan remaining = _baseScript.timeTo(structure._nextProduction.TimeOfDay); player.sendMessage(0, String.Format("Next collection ready in {0} Hour(s) & {1} minute(s)", remaining.Hours, remaining.Minutes)); } break; } return(false); }
private float getMoveValue(CustomTile pTile, Building pBuilding) { float value = -(pBuilding.GetCost() / 3); //Remove cost from the value of the move. City tileCity = pTile.GetCity(); bool buildingIsProduction = false; float happinessValue = 0; float moneyValue = 0; float collectionValue = 1; if (pBuilding is ProductionBuilding) { buildingIsProduction = true; ProductionBuilding prodBuilding = pBuilding as ProductionBuilding; happinessValue += prodBuilding.GetHappinessGain(); moneyValue += prodBuilding.GetMoneyGain(); collectionValue = 0; } if (pBuilding is FunctionBuilding) { return(-50); } Building[] buildingsInRange = tileCity.GetBuildingsAroundTile(1, pTile); foreach (Building b in buildingsInRange) { if (b is CollectionBuilding && buildingIsProduction) { //If this move places a production building next to a collection building, add value to the move. collectionValue += 1; } else if (b is ProductionBuilding) { if (!buildingIsProduction) { //If this move places a collection building next to a production building, add value to the move. ProductionBuilding prodBuilding = b as ProductionBuilding; happinessValue += prodBuilding.GetHappinessGain(); moneyValue += prodBuilding.GetMoneyGain(); } else if (pBuilding.GetType() == b.GetType()) { ProductionBuilding prodBuilding = pBuilding as ProductionBuilding; happinessValue += prodBuilding.GetHappinessGain() * Glob.FactoryProductionMultiplier; moneyValue += prodBuilding.GetMoneyGain() * Glob.FactoryProductionMultiplier; //If a production building is placed next to a production building of the same type, add value to the move. } else { //If a production building is placed next to a production building of a different type, subtract value from the move. ProductionBuilding prodBuilding = pBuilding as ProductionBuilding; happinessValue -= prodBuilding.GetHappinessGain() * Glob.FactoryProductionMultiplier; moneyValue -= prodBuilding.GetMoneyGain() * Glob.FactoryProductionMultiplier; } } } if (tileCity.GetBudget() < 25) { moneyValue *= 2; } value += (happinessValue + moneyValue) * collectionValue; return(value); }
public void Init(ProductionBuilding _pb) { m_PB = _pb; m_Title.text = m_PB.m_UIName; m_Cost.text = UIManager.ConvertFloatToStringPrice(_pb.m_Cost); m_Balance.text = UIManager.ConvertFloatToStringPriceWithSign(_pb.m_OperatingCost, out Color c); m_Balance.color = c; m_Btn.interactable = false; m_UnlockBG.color = Color.red; m_Conditions = _pb.m_Production.m_Conditions; foreach (ProductionStat ps in m_PB.m_Production.m_Output) { GameObject obj = Instantiate(Output_Prefab, transform); obj.transform.SetSiblingIndex(1); m_Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, m_Rect.rect.height + 50f); TextMeshProUGUI t = null; foreach (Transform child in obj.transform) { if (child.gameObject.tag == "EditText") { t = child.GetComponent <TextMeshProUGUI>(); break; } } if (t == null) { Debug.LogError("No EditText Tag found in: " + obj); return; } t.text = ps.m_Amount.ToString() + " " + ps.m_Product.m_UI_Name; if (ps.m_Product.m_UI_Sprit != null) { Image i = obj.GetComponentInChildren <Image>(); i.sprite = ps.m_Product.m_UI_Sprit; } } foreach (ProductionStat ps in m_PB.m_Production.m_Input) { GameObject obj = Instantiate(Input_Prefab, transform); obj.transform.SetSiblingIndex(1); m_Rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, m_Rect.rect.height + 50f); TextMeshProUGUI t = null; foreach (Transform child in obj.transform) { if (child.gameObject.tag == "EditText") { t = child.GetComponent <TextMeshProUGUI>(); break; } } if (t == null) { Debug.LogError("No EditText Tag found in: " + obj); return; } t.text = ps.m_Amount.ToString() + " " + ps.m_Product.m_UI_Name; if (ps.m_Product.m_UI_Sprit != null) { Image i = obj.GetComponentInChildren <Image>(); i.sprite = ps.m_Product.m_UI_Sprit; } } }
public void OpenUI(ProductionBuilding building) { MyUI.SetActive(true); currentBuilding = building; PopulateRecipieArea(building.RecipeBook); }
private void Update() { if (Input.GetKeyUp(keyInteract)) { if (target != null) { switch (targetTag) { case "Seedbag": Seedbag seedbag = target.GetComponent <Seedbag>(); if (seedbag != null && product == null) { seedbag.Interact(crop, hasCan, this); } break; case "Field": Field field = target.GetComponent <Field>(); if (field != null && product == null) { field.Interact(crop, hasCan, this); } break; case "Can": Can can = target.GetComponent <Can>(); if (can != null && product == null) { can.Interact(crop, hasCan, this); } break; case "Table": Table table = target.GetComponent <Table>(); if (table != null) { table.Interact(crop, product, hasCan, this); } break; case "Trash": Trash trash = target.GetComponent <Trash>(); if (trash != null) { trash.Interact(crop, product, hasCan, this); } break; case "Tree": Trees tree = target.GetComponent <Trees>(); if (tree != null) { tree.Interact(crop, hasCan, this); } break; case "ProductionB": ProductionBuilding building = target.GetComponent <ProductionBuilding>(); if (building != null) { if (crop != null) { product = crop.MakeProductFromCrop(); if (product != null) { building.Interact(product, this); } } else if (product != null) { building.Interact(product, this); } else if (crop == null) { building.Interact(null, this); } } break; case "SpawnedItems": SpawnItems items = target.GetComponent <SpawnItems>(); if (items != null && product == null) { items.Interact(crop, hasCan, this); } break; case "Well": Well well = target.GetComponent <Well>(); if (well != null && product == null) { well.Interact(crop, hasCan, this); } break; case "TargetPoint": TargetPoint point = target.GetComponent <TargetPoint>(); if (point != null) { if (crop != null) { product = crop.MakeProductFromCrop(); } if (product != null) { point.Interact(product, this); } } break; } } else if (hasCan) //for placing the can { can.GetComponent <Can>().Interact(crop, hasCan, this); } } }
public virtual void OnStateEnter(ProductionBuilding productionBuilding) { m_targetBuilding = productionBuilding; }
public void Release() { idText.text = string.Empty; productionBuilding = null; }
public void SetProductionInfo(ProductionBuilding _pb) { m_pii.SetProductionInfo(_pb); }
// Try to place a building at a certain map tile public void PlaceBuildingOnTile( MapTile tile, uint mapX, uint mapY, BuildingCategoryParams buildingCategoryParams, BuildingSpawner spawnBuilding ) { if (tile.Building != null) { return; } if (!buildingCategoryParams.IsCompatibleTileType(tile.Type)) { return; } if (!Economy.CanAfford(buildingCategoryParams.BuildCostMoney)) { return; } var enoughPlanksAvailable = this.Warehouse.IsAvailable( type: ResourceType.Plank, amount: buildingCategoryParams.BuildCostPlanks ); if (!enoughPlanksAvailable) { return; } Economy.SpendMoney(buildingCategoryParams.BuildCostMoney); this.Warehouse.Pick( type: ResourceType.Plank, amount: buildingCategoryParams.BuildCostPlanks ); var pos = this.MapToWorldMapper.GetWorldPosition( mapX: mapX, mapY: mapY, tile: tile ); spawnBuilding(pos); AbstractBuilding abstractBuilding; if (buildingCategoryParams.isProductionBuilding) { abstractBuilding = new ProductionBuilding( upkeepCost: buildingCategoryParams.UpkeepCost, resourceGenerationInterval: ( // TODO: this assumes one tick == one second (int)buildingCategoryParams.ResourceGenerationInterval ), outputResource: buildingCategoryParams.OutputResource, outputCount: buildingCategoryParams.OutputCount, inputResources: buildingCategoryParams.InputResources, efficiency: GetBuildingEfficiency( mapX: mapX, mapY: mapY, scaleTileType: ( buildingCategoryParams.EfficiencyScaleTileType ), scaleMinNeighbors: ( buildingCategoryParams.EfficiencyScaleMinNeighbors ), scaleMaxNeighbors: ( buildingCategoryParams.EfficiencyScaleMaxNeighbors ) ), areResourcesAvailable: this.Warehouse.IsAvailable, pickResources: this.Warehouse.Pick ); abstractBuilding.ResourcesProduced += (sender, args) => { var senderBuilding = (ProductionBuilding)sender; this.Warehouse.Store( type: senderBuilding.OutputResource, amount: senderBuilding.OutputCount ); }; } else { abstractBuilding = new HousingBuilding(0); } tile.Building = abstractBuilding; }
private void Awake() { _building = GetComponent <ProductionBuilding>(); _requiredWorker = _building.ProductionBuildingStats.JobsAvailable; }
void OnMenueOpen(ProductionBuilding b) { OnMenueOpen(); }