예제 #1
0
        public bool Equip(Item item, bool automaticallyUnequip = true)
        {
            if (!this.AllItems.Contains(item))
                return false;

            var armor = item as Armor;
            if (armor != null)
            {
                if (this.ArmorItem == null || automaticallyUnequip)
                {
                    this.ArmorItem = armor;
                    return true;
                }

                return false;
            }

            var spellBook = item as SpellBook;
            if (spellBook != null)
            {
                if (this.SpellBookItem == null || automaticallyUnequip)
                {
                    this.SpellBookItem = spellBook;
                    return true;
                }

                return false;
            }

            var weightedItem = item as WeightedItem;
            if (weightedItem == null)
                return false;

            if (weightedItem.Weight == Weight.Heavy)
            {
                if (this.HeavySlotItem == null || automaticallyUnequip)
                {
                    this.HeavySlotItem = weightedItem;
                    return true;
                }

                return false;
            }

            if (weightedItem.Weight == Weight.Medium)
            {
                if (this.MediumSlot1Item == null)
                {
                    this.MediumSlot1Item = weightedItem;
                    return true;
                }

                if (this.MediumSlot2Item == null)
                {
                    this.MediumSlot2Item = weightedItem;
                    return true;
                }

                if (automaticallyUnequip)
                {
                    this.MediumSlot1Item = weightedItem;
                    return true;
                }

                return false;
            }

            if (weightedItem.Weight == Weight.Light)
            {
                if (this.LightSlotItem == null || automaticallyUnequip)
                {
                    this.LightSlotItem = weightedItem;
                    return true;
                }

                return false;
            }

            return false;
        }
예제 #2
0
 public void Remove(Item item)
 {
     if (this.m_Items.Contains(item))
         this.m_Items.Remove(item);
 }
예제 #3
0
 public void Add(Item item)
 {
     if (!this.m_Items.Contains(item))
         this.m_Items.Add(item);
 }