Exemplo n.º 1
0
        public Farm(Map map, IntVector pos)
        {
            Type     = BuildingType.Farm;
            Consumer = new NutrientInput(map, this, (0, 0), 4);
            var producer = new DirectProducer(5, 1, Item.Food);

            Producer       = producer;
            Output         = producer;
            ProcessingTime = 2;
            Width          = 4;
            Height         = 4;
        }
Exemplo n.º 2
0
        public Lumbermill(Map map, IntVector pos)
        {
            Type     = BuildingType.Lumbermill;
            Width    = 2;
            Height   = 2;
            Consumer = new ResourceInput(map, this, (-2, -2), 6, Item.Wood);
            var producer = new DirectProducer(5, 1, Item.Wood);

            Producer       = producer;
            Output         = producer;
            ProcessingTime = 1;
            Entrance       = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway);
        }
Exemplo n.º 3
0
        public Mine(Map map, IntVector pos)
        {
            var item = map.GetNearestResource(pos + (Width / 2, Height / 2), 2, Item.Stone, Item.IronOre, Item.CopperOre);

            Type     = BuildingType.Mine;
            Consumer = new ResourceInput(map, this, (-1, -1), 4, item);
            var output = new DirectProducer(5, 1, item);

            Output         = output;
            Producer       = output;
            ProcessingTime = 2;
            Width          = 2;
            Height         = 2;
            Entrance       = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway);
        }
Exemplo n.º 4
0
        private void LoadRecipe(Recipe recipe)
        {
            RecipeChanged?.Invoke(this);
            var input = new DirectConsumer();

            foreach (RecipeInput i in recipe.Input)
            {
                input.AddItem(i.Count * 2, i.Count, i.Item);
            }
            Input    = input;
            Consumer = input;
            var producer = new DirectProducer(recipe.OutputCount * 5, recipe.OutputCount, recipe.OutputItem);

            Producer       = producer;
            Output         = producer;
            ProcessingTime = recipe.ProcessingTime;
        }
Exemplo n.º 5
0
        private void SetItem(Item item)
        {
            Item outputItem = item switch
            {
                Item.IronOre => Item.Iron,
                Item.CopperOre => Item.Copper,
                _ => throw new ArgumentException("Invalid smelter input")
            };

            var input  = new DirectConsumer(10, 5, item);
            var output = new DirectProducer(10, 1, outputItem);

            Input    = input;
            Consumer = input;
            Output   = output;
            Producer = output;
        }
    }