コード例 #1
0
    public int GetAllOf(ExtractableType itemType)
    {
        List <Extractable> toRemove = new List <Extractable>();
        int count = 0;

        for (int i = 0; i < itemsStored.Count; i++)
        {
            if (itemsStored[i].extractableType == itemType)
            {
                toRemove.Add(itemsStored[i]);
            }
        }
        if (toRemove.Count > 0)
        {
            foreach (Extractable item in toRemove)
            {
                if (RemoveItem(item) == false)
                {
                    continue;
                }
                count++;
            }
        }
        return(count);
    }
コード例 #2
0
ファイル: Extractable.cs プロジェクト: cesarrac/LDJam40
 public string spriteID = string.Empty; // for re-using the same sprite when re-loading area
 public Extractable(ExtractableType _extractableType, int _weight, int maxYield, float rate, int maxCap)
 {
     yield           = Random.Range(1, maxYield);
     capacity        = Random.Range(1, maxCap);
     extractableType = _extractableType;
     yieldRate       = rate;
     weight          = _weight;
 }
コード例 #3
0
    public int TotalInstancesOfItem(ExtractableType itemType)
    {
        int count = 0;

        for (int i = 0; i < itemsStored.Count; i++)
        {
            if (itemsStored[i].extractableType == itemType)
            {
                count++;
            }
        }
        return(count);
    }