Пример #1
0
        // TODO Rework this later to only be used when a character first logs in. A different system will be needed to ensure previously equipped items from last login remain equipped.
        public void EquipStartingItems(EquippableItem item)
        {
            EquippableItem previousItem;

            if (equipmentPanel.AddItem(item, out previousItem))
            {
                OnItemEquipped(item);
                item.Equip(character);
                character.StatPanel.UpdateStatValues();
            }
        }
Пример #2
0
        void Drop(ItemSlot dropItemSlot)
        {
            if (draggedSlot == null)
            {
                return;
            }

            if (dropItemSlot.CanReceiveItem(draggedSlot.Item) && draggedSlot.CanReceiveItem(dropItemSlot.Item))
            {
                EquippableItem dragItem = draggedSlot.Item as EquippableItem;
                EquippableItem dropItem = dropItemSlot.Item as EquippableItem;

                if (draggedSlot is EquipmentSlot)
                {
                    if (dragItem != null)
                    {
                        dragItem.UnEquip(character);
                    }
                    if (dropItem != null)
                    {
                        dropItem.Equip(character);
                    }
                }

                if (dropItemSlot is EquipmentSlot)
                {
                    if (dragItem != null)
                    {
                        OnItemEquipped(dragItem);
                        dragItem.Equip(character);
                    }
                    if (dropItem != null)
                    {
                        dropItem.UnEquip(character);
                    }
                }
                character.StatPanel.UpdateStatValues();

                Item draggedItem = draggedSlot.Item;
                draggedSlot.Item  = dropItemSlot.Item;
                dropItemSlot.Item = draggedItem;
            }
        }
Пример #3
0
 public void Equip(EquippableItem item)
 {
     if (inventory.RemoveItem(item))
     {
         EquippableItem previousItem;
         if (equipmentPanel.AddItem(item, out previousItem))
         {
             if (previousItem != null)
             {
                 inventory.AddItem(previousItem);
                 previousItem.UnEquip(character);
                 character.StatPanel.UpdateStatValues();
             }
             OnItemEquipped(item);
             item.Equip(character);
             character.StatPanel.UpdateStatValues();
         }
         else
         {
             inventory.AddItem(item);
         }
     }
 }