Exemplo n.º 1
0
    public void EquipSlotLeftClicked(EquipSlot slot)
    {
        MouseSlot mouseSlot = MouseSlot.instance;
        Item      mouseItem = MouseSlot.instance.Item();

        if (slotClickHelper.CheckItemType() == false)
        {
            return;
        }

        if (mouseItem == null && slot.Equipment() == null) //or slot.Equipment() == naked or unarmed?
        {
            Debug.Log("BOTH SLOTS EMPTY");
            return;
        }

        if (mouseItem == null && slot.Equipment() != null)
        {
            slotClickHelper.PickUpItemIntoEmptyMouseSlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Equipment() == null) //or slot.Equipment() == naked or unarmed?
        {
            slotClickHelper.PlaceItemInEmptySlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Equipment() != null) //or slot.Equipment() == naked or unarmed?
        {
            slotClickHelper.SwapItems(mouseSlot, slot);
            return;
        }
    }
Exemplo n.º 2
0
    public void InventorySlotLeftClicked(InventorySlot slot)
    {
        MouseSlot mouseSlot = MouseSlot.instance;
        Item      mouseItem = MouseSlot.instance.Item();

        if (mouseItem == null && slot.Item() == null)
        {
            Debug.Log("BOTH SLOTS EMPTY");
            return;
        }

        if (mouseItem == null && slot.Item() != null)
        {
            slotClickHelper.PickUpItemIntoEmptyMouseSlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Item() == null)
        {
            slotClickHelper.PlaceItemInEmptySlot(mouseSlot, slot);
            return;
        }

        if (mouseItem != null && slot.Item() != null)
        {
            slotClickHelper.SwapItems(mouseSlot, slot);
            return;
        }
    }
Exemplo n.º 3
0
    //HELPERS

    public void PickUpItemIntoEmptyMouseSlot(MouseSlot mouseSlot, EquipSlot slot)
    {
        Debug.Log("PICK UP ITEM INTO EMPTY MOUSE SLOT");           //or equipment == naked or unarmed?
        Item previousItem = slot.Equipment();                      //save a copy of the slotItem

        slot.EquipmentManager().Unequip(previousItem.myEquipSlot); //unequip item currently in equip slot
        mouseSlot.UpdateItem(previousItem);                        //place previous item in the mouseSlot (as an item)?
    }
Exemplo n.º 4
0
    //HELPERS

    public void PickUpItemIntoEmptyMouseSlot(MouseSlot mouseSlot, InventorySlot slot)
    {
        Debug.Log("PICK UP ITEM INTO EMPTY MOUSE SLOT");
        Item previousItem = slot.Item();    //save a copy of the slotItem

        inv.Remove(previousItem);           //remove the item in the slot
        mouseSlot.UpdateItem(previousItem); //place previous item in the mouseSlot
    }
Exemplo n.º 5
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one instance of MouseSlot found");
         return;
     }
     instance = this;
 }
Exemplo n.º 6
0
    public void PlaceItemInEmptySlot(MouseSlot mouseSlot, InventorySlot slot)
    {
        Item mouseItem = mouseSlot.Item();

        Debug.Log("PLACING ITEM IN EMPTY SLOT");
        mouseItem.mySlotNum = slot.slotNum; //assign item's slotNum to this slot
        inv.AddToSpecificSlot(mouseItem);   //drop item in slot
        mouseSlot.UpdateItem(null);         //clear mouseSlot's item
    }
Exemplo n.º 7
0
    public void SwapItems(MouseSlot mouseSlot, InventorySlot slot)
    {
        Item mouseItem    = mouseSlot.Item();
        Item previousItem = slot.Item();

        Debug.Log("SWAPPING " + mouseSlot.Item().name + " with " + slot.Item().name);
        mouseItem.mySlotNum = slot.slotNum; //assign item's slotNum to this slot
        inv.AddToSpecificSlot(mouseItem);   //drop item in slot, removing old item is taken care of here too
        mouseSlot.UpdateItem(previousItem); //add old item to mouseSlot
    }
Exemplo n.º 8
0
    public void PlaceItemInEmptySlot(MouseSlot mouseSlot, EquipSlot slot)
    {
        Item mouseItem = mouseSlot.Item();

        //make sure equipment would be going in the correct slot
        if (!CheckEquipSlot(mouseItem.myEquipSlot, slot))
        {
            return;
        }

        Debug.Log("PLACING ITEM IN EMPTY SLOT");
        slot.EquipmentManager().Equip(mouseItem);
        mouseSlot.UpdateItem(null); //clear mouseSlot's item
    }
Exemplo n.º 9
0
    public void SwapItems(MouseSlot mouseSlot, EquipSlot slot)
    {
        Item mouseItem = mouseSlot.Item();

        //make sure equipment would be going in the correct slot
        if (!CheckEquipSlot(mouseItem.myEquipSlot, slot))
        {
            return;
        }

        Debug.Log("SWAPPING ITEMS");
        Item previousItem = slot.Equipment();        //save a copy of the slotItem

        slot.EquipmentManager().Equip(mouseItem);
        mouseSlot.UpdateItem(previousItem);        //add old item to mouseSlot
    }