Exemplo n.º 1
0
        public void AddGem(Gem gem)
        {
            GemAmount.Add(gem);

            long gemAmount  = gem.Amount;
            long goldAmount = CalculateCurrentGoldAmount();

            if (gemAmount > goldAmount)
            {
                GemAmount.Remove(gem);
            }
            else if (CalculateCurrentGemAmount() > goldAmount)
            {
                GemAmount.Remove(gem);
            }
            else if (CalculateTotallAmount() > MaxCapacity)
            {
                GemAmount.Remove(gem);
            }
        }
Exemplo n.º 2
0
 public long CalculateCurrentGemAmount()
 {
     return(GemAmount.Select(x => x.Amount).Sum());
 }