public void GiveLoot(Loot l) { int r = STACKSIZE - l.GetLootAmount(); int amount = 0; if (GetLootAmount() <= r) { amount = GetLootAmount(); } else { amount = r; } this.amount -= amount; l.AddLoot(amount); l.ResetTime(); }