コード例 #1
0
 protected void AddUpgradeSlot(Upgrade.UpgradeSlot slot)
 {
     if (!BuiltInSlots.ContainsKey(slot))
     {
         BuiltInSlots.Add(slot, 1);
     }
     else
     {
         BuiltInSlots[slot]++;
     }
 }
コード例 #2
0
        private bool HasFreeUpgradeSlot(Upgrade.UpgradeSlot slot)
        {
            bool result = false;

            if (BuiltInSlots.ContainsKey(slot))
            {
                int slotsAvailabe = BuiltInSlots[slot];
                foreach (var upgrade in InstalledUpgrades)
                {
                    if (upgrade.Key == slot)
                    {
                        slotsAvailabe--;
                    }
                }

                if (slotsAvailabe > 0)
                {
                    result = true;
                }
            }
            return(result);
        }