Esempio n. 1
0
    public void RemoveBud(PackagedBud toRemove, float weightToRemove)
    {
        List <PackagedBud> newList = new List <PackagedBud>();
        bool useNewList            = false;

        foreach (PackagedBud packagedBud in bud)
        {
            if (packagedBud.uniqueID == toRemove.uniqueID)
            {
                if (packagedBud.weight > weightToRemove)
                {
                    packagedBud.weight = packagedBud.weight - weightToRemove;
                }
                else if (packagedBud.weight <= weightToRemove)
                {
                    useNewList = true;
                }
            }
            else
            {
                newList.Add(packagedBud);
            }
        }
        if (useNewList)
        {
            bud = newList;
        }
        StorageBox storageBox = (StorageBox)product;

        storageBox.bud = bud;
    }
Esempio n. 2
0
    public int CheckAgainstList(PackagedBud value)
    {
        int indexCounter = 0;

        foreach (PackagedBud packedBud in bud)
        {
            if (packedBud.strain.strainID == value.strain.strainID)
            {
                return(indexCounter);
            }
            indexCounter++;
        }
        return(-1);
    }
Esempio n. 3
0
    public void AddBud(PackagedBud newBud)
    {
        int index = CheckAgainstList(newBud);

        if (!(index >= 0))
        {
            bud.Add(newBud);
        }
        else
        {
            bud[index].AddBud(newBud.weight);
        }
        currentWeight += Mathf.RoundToInt(newBud.weight);
        StorageBox storageBox = (StorageBox)product;

        storageBox.bud = bud;
    }
Esempio n. 4
0
        //public int parentBoxUniqueID;

        public PackagedBud_s(PackagedBud bud) : base(Product.type_.packagedBud, bud.strain.strainID, 0, bud.strain.name)
        {
            weight = bud.weight;
            //parentBoxUniqueID = product.parentBox.product.uniqueID;
        }