Added shield items for all classes, finalised item display in inventory, v1.3.0

This commit is contained in:
Nicola Sovic
2022-07-03 12:12:15 +02:00
parent 6631a9f9dc
commit e143f4e7c9
24 changed files with 138 additions and 9 deletions

View File

@@ -51,7 +51,8 @@ namespace Assets.Scripts
{
slots[j].GetComponent<InventorySlot>().setItem(item);
itemAdded = true;
slots[j].GetComponent<RawImage>().color = Color.red;
slots[j].GetComponent<RawImage>().color = item.rarityColor;
slots[j].GetComponent<RawImage>().texture = item.image;
break;
}
}
@@ -80,15 +81,19 @@ namespace Assets.Scripts
private void checkInventoryColors()
{
Item item;
for (int i = 0; i < slots.Length; i++)
{
if (slots[i].GetComponent<InventorySlot>().getItem() != null)
item = slots[i].GetComponent<InventorySlot>().getItem();
if (item != null)
{
slots[i].GetComponent<RawImage>().color = Color.red;
slots[i].GetComponent<RawImage>().color = item.rarityColor;
slots[i].GetComponent<RawImage>().texture = item.image;
}
else
{
slots[i].GetComponent<RawImage>().color = Color.white;
slots[i].GetComponent<RawImage>().texture = null;
}
}
}
@@ -96,6 +101,7 @@ namespace Assets.Scripts
private void checkEquipColors()
{
GameObject slot = head;
Item item;
for (int i = 0; i < 8; i++)
{
switch (i)
@@ -125,9 +131,11 @@ namespace Assets.Scripts
slot = ring;
break;
}
if (slot.GetComponent<InventorySlot>().getEquip() != null)
item = slot.GetComponent<InventorySlot>().getEquip();
if (item != null)
{
slot.GetComponent<RawImage>().color = Color.red;
slot.GetComponent<RawImage>().color = item.rarityColor;
slot.GetComponent<RawImage>().texture = item.image;
}
else
{
@@ -150,9 +158,9 @@ namespace Assets.Scripts
{
switch (place)
{
case ItemPlace.SHIELD:
case ItemPlace.LEFTHAND:
return leftHand.GetComponent<InventorySlot>().getEquip();
case ItemPlace.WEAPON:
case ItemPlace.RIGHTHAND:
return rightHand.GetComponent<InventorySlot>().getEquip();
case ItemPlace.HELMET:
return head.GetComponent<InventorySlot>().getEquip();