Updated rarity, fixed hp/mp display on point usage, fixed item moving issue, v1.3.0

This commit is contained in:
Nicola Sovic
2022-07-04 11:54:31 +02:00
parent 977f9ca5cf
commit dd0251cb3e
5 changed files with 42 additions and 38 deletions

View File

@@ -125,16 +125,16 @@ namespace Assets.Scripts
inventory.dragImage.GetComponent<RawImage>().color = new Color(0,0,0,0);
inventory.dragImage.GetComponent<RawImage>().texture = null;
inventory.dragImage.transform.position = new Vector3(0,0,0);
GameObject startDrag = inventory.getDrag();
InventorySlot startDrag = inventory.getDrag().GetComponent<InventorySlot>();
Item item;
bool isSwap = false;
if (startDrag.GetComponent<InventorySlot>().place == ItemPlace.BAG)
if (startDrag.place == ItemPlace.BAG)
{
item = startDrag.GetComponent<InventorySlot>().getItem(currentBag);
item = startDrag.getItem(startDrag.currentBag);
}
else
{
item = startDrag.GetComponent<InventorySlot>().getEquip();
item = startDrag.getEquip();
}
if (item != null)
{
@@ -146,13 +146,17 @@ namespace Assets.Scripts
{
if (items[currentBag] != null)
{
if (startDrag.GetComponent<InventorySlot>().place == ItemPlace.BAG)
if (items[currentBag].getPlace() != startDrag.place)
{
startDrag.GetComponent<InventorySlot>().setItem(items[currentBag], currentBag);
return;
}
if (startDrag.place == ItemPlace.BAG)
{
startDrag.setItem(items[currentBag], currentBag);
}
else
{
startDrag.GetComponent<InventorySlot>().setEquip(items[currentBag]);
startDrag.setEquip(items[currentBag]);
inventory.calculateStatBoost(item.getAttributes(), false);
inventory.calculateStatBoost(items[currentBag].getAttributes(), true);
}
@@ -164,9 +168,9 @@ namespace Assets.Scripts
{
if (equip != null)
{
if (startDrag.GetComponent<InventorySlot>().place == ItemPlace.BAG)
if (startDrag.place == ItemPlace.BAG)
{
startDrag.GetComponent<InventorySlot>().setItem(equip, currentBag);
startDrag.setItem(equip, startDrag.currentBag);
isSwap = true;
inventory.calculateStatBoost(equip.getAttributes(), false);
}
@@ -180,14 +184,14 @@ namespace Assets.Scripts
}
if (!isSwap)
{
if (startDrag.GetComponent<InventorySlot>().place != ItemPlace.BAG)
if (startDrag.place != ItemPlace.BAG)
{
inventory.calculateStatBoost(startDrag.GetComponent<InventorySlot>().getEquip().getAttributes(), false);
startDrag.GetComponent<InventorySlot>().removeEquip();
inventory.calculateStatBoost(startDrag.getEquip().getAttributes(), false);
startDrag.removeEquip();
}
else
{
startDrag.GetComponent<InventorySlot>().removeItem();
startDrag.removeItem();
}
}
}