Example #1
0
    public virtual bool HandleGoods(GoodsCollection inventory)
    {
        for (int i = 0; i < Workers; i++)
        {
            //check required materials
            foreach (Good good in MaterialsRequired.Keys)
            {
                if (inventory[good] < MaterialsRequired[good])
                {
                    return(false);
                }
            }

            //+- goods
            foreach (Good good in inventory.Keys.ToArray())
            {
                if (MaterialsRequired.ContainsKey(good))
                {
                    inventory[good] -= MaterialsRequired[good];
                }

                if (MaterialsProduced.ContainsKey(good))
                {
                    inventory[good] += MaterialsProduced[good];
                }
            }

            BuildingEffect?.Invoke(inventory);
        }

        return(true);
    }
Example #2
0
 public virtual string GetMaterialsProducedString()
 {
     return(MaterialsProduced.ToString());
 }