Exemplo n.º 1
0
 public void SetHotbar()
 {
     for (int i = 0; i < MaxActiveColumns; i++)
     {
         int slotToCopy = i + MaxColumns * (ActiveRow - 1);
         MimicInventorySlot CopyHere = HotbarSlots[i];
         InventorySlot      CopyThis = ItemInventorySlots[slotToCopy];
         CopyThis.SetBackgrounColors(Color.green);
         CopyHere.CopyThisSlot(CopyThis);
         CopyHere.ApplyCopy();
     }
     if (EquiptedSlotNum > 0)
     {
         EquipItem(EquiptedSlotNum);
     }
 }
Exemplo n.º 2
0
    public void EquipItem(int slotNumber = 1)
    {
        int slotToCopy = slotNumber + MaxColumns * (ActiveRow - 1) - 1;
        MimicInventorySlot CopyHere = HotbarSlots[slotNumber - 1];
        InventorySlot      CopyThis = ItemInventorySlots[slotToCopy];

        CopyThis.SetBackgrounColors(Color.red);
        CopyHere.CopyThisSlot(CopyThis);
        CopyHere.ApplyCopy();

        // Set the equipted item
        if (EquiptedSlot == null)
        {
            // Set up slot
            EquiptedSlot      = CopyThis;
            EquiptedMimicSlot = CopyHere;
            PA.Equip(EquiptedSlot.GetHeldItem());
        }
        else if (EquiptedSlot != CopyThis)
        {
            // Set old slot to default
            if (slotNumber != EquiptedSlotNum)
            {
                EquiptedSlot.SetBackgrounColors(Color.green);
                EquiptedMimicSlot.CopyThisSlot(EquiptedSlot);
                EquiptedMimicSlot.ApplyCopy();
            }
            PA.UnEquip(EquiptedSlot.GetHeldItem());

            // Set new slot
            EquiptedSlot      = CopyThis;
            EquiptedMimicSlot = CopyHere;
            PA.Equip(EquiptedSlot.GetHeldItem());
        }
        EquiptedSlotNum = slotNumber;
    }