fixed unity inventory and texts

This commit is contained in:
TAASONI3
2023-07-11 18:36:46 +02:00
parent d0d9a6847a
commit 18dfaf7602
12 changed files with 367 additions and 273 deletions

View File

@@ -30,7 +30,6 @@ namespace Assets.Scripts
TooltipHandler tooltip;
public GameObject currentSlot;
// Start is called before the first frame update
void Start()
@@ -50,18 +49,19 @@ namespace Assets.Scripts
private void createStatBoost()
{
if (statBoost == null)
{
statBoost = new Dictionary<string, int>();
statBoost.Add("HP", 0);
statBoost.Add("MP", 0);
statBoost.Add("HPR", 0);
statBoost.Add("MPR", 0);
statBoost.Add("STR", 0);
statBoost.Add("DEX", 0);
statBoost.Add("INT", 0);
statBoost.Add("LCK", 0);
}
statBoost = new Dictionary<string, int>();
statBoost.Add("HP", 0);
statBoost.Add("MP", 0);
statBoost.Add("HPR", 0);
statBoost.Add("MPR", 0);
statBoost.Add("STR", 0);
statBoost.Add("DEX", 0);
statBoost.Add("INT", 0);
statBoost.Add("LCK", 0);
}
void OnDisable(){
statBoost = new Dictionary<string, int>();
}
public void addItem(Item item)
@@ -195,6 +195,41 @@ namespace Assets.Scripts
public Dictionary<string, int> getEquipmentBonus()
{
createStatBoost();
GameObject equip = head;
for (int i = 0; i < 8; i++)
{
switch (i)
{
case 0:
equip = head;
break;
case 1:
equip = rightHand;
break;
case 2:
equip = leftHand;
break;
case 3:
equip = amulet;
break;
case 4:
equip = feet;
break;
case 5:
equip = shoulders;
break;
case 6:
equip = chest;
break;
case 7:
equip = ring;
break;
}
if (equip.GetComponent<InventorySlot>().getEquip() != null)
{
calculateStatBoost(equip.GetComponent<InventorySlot>().getEquip().getAttributes(), true);
}
}
return statBoost;
}