public void RemoveStackAmounts() { for (int i = 0; i < InventoryManage.Count; i++) { if (InventoryManage[i].isASecondary == 1) { if (InventoryManage[i].StackAmounts <= 0) { if (InventoryManage[i].CurrentInventorySlot == SwitchWeapons.CurrentLoadedProjectile) { SwitchWeapons.CurrentLoadedProjectile = -1; SwitchWeapons.DestroyObject(SwitchWeapons.CurrentProjectileObject, 1); } InventoryButtonsIcons[InventoryManage[i].CurrentInventorySlot].GetComponent <Mask>().showMaskGraphic = false; InventoryButtonsIcons[InventoryManage[i].CurrentInventorySlot].sprite = DefaultSprite; InventoryButtonsStackText[InventoryManage[i].CurrentInventorySlot].text = string.Empty; InventoryManage.RemoveAt(i); } } } }
public void FunctionOnPointerClick(BaseEventData Basedata) { PointerEventData data = ( PointerEventData )Basedata; if (data.clickCount == 2 && character.Attacking == false && terrain.canvas.GetComponentInChildren <MainGUI>().timeElapsedProgressBar <= Time.time) { if (CurrentPointerButtonIndex >= 0 && CurrentPointerButtonIndex <= 24) { characterInventory.CurrentInventoryItemSlot = CurrentPointerButtonIndex; } for (int i = 0; i < characterInventory.InventoryManage.Count; i++) { if (characterInventory.InventoryManage[i].CurrentInventorySlot == characterInventory.CurrentInventoryItemSlot && characterInventory.InventoryManage[i].isASecondary == 0 && characterInventory.CurrentInventoryItemSlot == WepSwitch.CurrentWeaponItemSlot) // for weapons that are primary - clicking an already equipped item { CurrentPointerButtonIndex = 100; characterInventory.InventoryButtonRects[WepSwitch.CurrentWeaponItemSlot].transform.GetComponentInChildren <Image>().color = new Color(1, 1, 1, 0.66f); WepSwitch.DestroyObject(WepSwitch.CurrentObject, 0); if (WepSwitch.CurrentProjectileObject != null) { WepSwitch.DestroyObject(WepSwitch.CurrentProjectileObject, 1); } character.SendFloats("ArmJump", 0); return; } else if (characterInventory.InventoryManage[i].CurrentInventorySlot == characterInventory.CurrentInventoryItemSlot && (characterInventory.CurrentInventoryItemSlot == armorSwitch.CurrentChestplateIteration || characterInventory.CurrentInventoryItemSlot == armorSwitch.CurrentHelmetIteration || characterInventory.CurrentInventoryItemSlot == armorSwitch.CurrentLegsIteration)) // for armors - clicking an already equipped item { CurrentPointerButtonIndex = 100; characterInventory.InventoryButtonRects[characterInventory.CurrentInventoryItemSlot].transform.GetComponentInChildren <Image>().color = new Color(1, 1, 1, 0.66f); armorSwitch.DropObject(characterInventory.CurrentInventoryItemSlot); // unequip return; } } for (int x = 0; x < Potions.PotionList.Count; x++) { if (Potions.PotionList[x].PotionName == characterInventory.InventoryButtonRects[characterInventory.CurrentInventoryItemSlot].GetComponentInChildren <Text>().text) { skillbarGUI.UsePotions(Potions.PotionList[x].PotionName); return; } } characterInventory.SetWeaponValues(); characterInventory.SetArmorValues(); characterInventory.SetToolValues(); if (UpgradeItems.CurrentUpgradeIndex == characterInventory.CurrentInventoryItemSlot) // update upgrade icons when equipping an item { UpgradeItems.PreviousUpgradedIcon.transform.GetComponentInChildren <Image>().sprite = characterInventory.DefaultSprite; UpgradeItems.PreviousUpgradedIcon.transform.GetComponentInChildren <Mask>().showMaskGraphic = true; UpgradeItems.AfterUpgradedIcon.transform.GetComponentInChildren <Image>().sprite = characterInventory.DefaultSprite; UpgradeItems.AfterUpgradedIcon.transform.GetComponentInChildren <Mask>().showMaskGraphic = true; } } }