Beispiel #1
0
    //sums up total inventory
    public int TotalAmountStored()
    {
        int sum = 0;

        for (int item = 0; item < Inventory.Length; item++)
        {
            sum += Inventory[item] * ResourcesDatabase.GetWeight(Enums.GetItemName(item, typeStored));
        }
        return(sum);
    }
Beispiel #2
0
    //sums up total queue
    public int AmountQueued()
    {
        int sum = 0;

        for (int item = 0; item < Queue.Length; item++)
        {
            sum += Queue[item] * ResourcesDatabase.GetWeight(Enums.GetItemName(item, typeStored));
        }
        return(sum);
    }
Beispiel #3
0
    //empty space for a particular type, both currently and futurely stored
    public int EmptySpaceFor(int a)
    {
        //weight of item
        int weight = ResourcesDatabase.GetWeight(Enums.GetItemName(a, typeStored));

        //if cannot accept type at all, return 0
        if (WillAccept[a] == 0)
        {
            return(0);
        }

        //actual space left, which is the max it will accept times the total potential space minus the amount stored
        int space = (int)(WillAccept[a] * stockpile / weight) - Inventory[a] - Queue[a];

        //if the total potential space is less than what could be stored individually, return the total potential space
        if (EmptySpace < space)
        {
            return(EmptySpace);
        }

        //otherwise return specifically for this type
        return(space);
    }