示例#1
0
 public void UnequipOffhand()
 {
     if (EquippedOffhand != null) 
         Items.Add(EquippedOffhand);
     
     EquippedOffhand = null;
 }
示例#2
0
        public void UseItem(int index)
        {
            if (Items.Count > index)
            {
                if (Items[index] is Armor)
                {
                    UnequipArmor();

                    EquippedArmor = (Armor)Items[index];
                    Items.RemoveAt(index);
                    return;
                }

                if (Items[index] is Weapon)
                {
                    UnequipWeapon();

                    EquippedWeapon = (Weapon)Items[index];
                    Items.RemoveAt(index);
                    return;
                }

                if (Items[index] is Offhand)
                {
                    UnequipOffhand();

                    EquippedOffhand = (Offhand)Items[index];
                    Items.RemoveAt(index);
                    return;
                }

                Items[index].Use(attachedCharacter);
            }

            Items.RemoveAll(o => o == null);
            Items.RemoveAll(o => o.Destroy);
        }