Beispiel #1
0
        public void UnequipWeapon()
        {
            if (EquippedWeapon != null)
                Items.Add(EquippedWeapon);

            EquippedWeapon = null;
        }
Beispiel #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);
        }