private void EquipEquipment(Equipment_Slot slot, Item theItem) { if (slot.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) { EquipRightHand(theItem); } if (slot.GetEquipmentSlotType() == EquipmentSlotType.BodyArmour) { print("Equiping some arrmor... Come on program it!!!"); } }
public Item WhichItemInSlot(Equipment_Slot slot) { if (slot.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) { return(rightHand); } if (slot.GetEquipmentSlotType() == EquipmentSlotType.BodyArmour) { return(bodyArmor); } return(null); }
public void UnEquipSlot(Equipment_Slot slot) { if (slot.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) { UnEquipRightHand(); } else { Debug.LogError("Slot type not supported"); } restartAnimationEvent(); }
private int getSlotId(Equipment_Slot equipmentSlot) { if (GameManager.instance.player.equippedItem[(int)equipmentSlot] == null)// If player clicked on an equipment that has been unequipped { slotId = GetComponent <InventorySlot>().item.slotId; } else { slotId = ItemManager.instance.GetItemDataById(GameManager.instance.player.equippedItem[(int)equipmentSlot]).slotId; // slotId of the current equipped item } return(slotId); }
public void EquipEquipmentInSlot(Item theItem, Equipment_Slot slot) // Equips in the correct slot // FOR ADDING NEW EQUIPMENTSLOTS { if (slot.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) { EquipRightHand(theItem); } if (slot.GetEquipmentSlotType() == EquipmentSlotType.BodyArmour) { //equipBodyArmour(theItem.GetItemBodyArmour()); EquipBodyArmour(theItem); } restartAnimationEvent(); }
private bool EquipmentSlotFree(Equipment_Slot equipmentSlot) { if (equipmentSlot.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) { if (rightHand == false) // FIND IF THE RIGHT HAND SLOT IS EMPY THEN RIGHT ALL THE OTHER SLOTS IF THEY ARE EMPTY { return(true); } return(false); } //add others equipment slots here Debug.LogError("EQUIPMENTSLOT FREE CHECK OUT OF BOUNDS"); return(false); }
public bool DoesEquipmentMatchSlot(Item theItem, Equipment_Slot slot) // Checks to see if the equipment matches the slot { if (theItem != null) { if (theItem.GetItemWeapon() != null || theItem.GetItemBodyArmour() != null) // FOR ADDING NEW EQUIPMENTSLOTS { print("Ready to put weapon in slot"); if (slot.GetEquipmentSlotType() == theItem.GetEquipmentSlotType()) // TODO PROGRAM THIS SO IT CAN LOOK AT THE SLOT AND THE WEAPON { print("Equip equipment"); return(true); } Debug.LogError("Wrong slot type"); return(false); } Debug.LogWarning("No weapon"); return(false); } print("no item"); return(false); }
private void DropIcon() { if (OverAnotherEquipmentSlot()) // Droping onto an equipment slot { isHoldIcon = false; selectedIcon.transform.SetParent(selectedIconOrginalHome.transform); selectedIcon.transform.position = selectedIconOrginalHome.transform.position; Inventory_Slot tempInventorySlot = selectedIcon.GetComponentInParent <Inventory_Slot>(); print(tempInventorySlot); SwapEquipmentAndInventory(OverAnotherEquipmentSlot(), tempInventorySlot); return; } if (OverAnotherInventorySlot() == null || OverAnotherInventorySlot() == selectedIconOrginalHome.GetComponent <Inventory_Slot>()) { isHoldIcon = false; selectedIcon.transform.SetParent(selectedIconOrginalHome.transform); selectedIcon.transform.position = selectedIconOrginalHome.transform.position; //print(selectedIcon.transform.position); } else { isHoldIcon = false; selectedIcon.transform.SetParent(selectedIconOrginalHome.transform); selectedIcon.transform.position = selectedIconOrginalHome.transform.position; if (selectedIconOrginalHome.GetComponent <Inventory_Slot>() != null) { print("Test1"); inventoryManager.SwitchBagSlots(selectedIcon.GetComponent <InventorySlotIcon>(), OverAnotherInventorySlot().GetComponentInChildren <InventorySlotIcon>()); } if (selectedIconOrginalHome.GetComponent <Equipment_Slot>() != null) // Droping from and equipment slot onto and inventory { Equipment_Slot tempEquipmentSlot = selectedIcon.GetComponentInParent <Equipment_Slot>(); SwapEquipmentAndInventory(tempEquipmentSlot, OverAnotherInventorySlot()); return; } } }
//=====Equipment Management with Inventory===== public void SwapEquipmentAndInventory(Equipment_Slot equipmentSlot, Inventory_Slot inventorySlot) { Item tempEquipSlotItem = equipmentManager.WhichItemInSlot(equipmentSlot); Item tempInventoryItem = inventoryManager.FindItemInSlot(inventorySlot); if (equipmentManager.DoesEquipmentMatchSlot(tempInventoryItem, equipmentSlot) == true) { Debug.Log("Slot is correct"); inventoryManager.RemoveItemFromInventory(null, inventoryManager.WhichInventorySlot(inventorySlot.GetComponentInChildren <InventorySlotIcon>())); inventoryManager.AddItemToInventory(tempEquipSlotItem, inventoryManager.WhichInventorySlot(inventorySlot.GetComponentInChildren <InventorySlotIcon>())); //equipmentManager.UnEquipSlot(equipmentSlot); Was stopping flow of execution, not sure why. equipmentManager.EquipEquipmentInSlot(tempInventoryItem, equipmentSlot); // TODO, Semi cheaty as it does not remove before adding new ones it just overides } else if (tempInventoryItem == null && tempEquipSlotItem != null) { inventoryManager.AddItemToInventory(tempEquipSlotItem, inventoryManager.WhichInventorySlot(inventorySlot.GetComponentInChildren <InventorySlotIcon>())); equipmentManager.EquipEquipmentInSlot(tempInventoryItem, equipmentSlot); } else { Debug.Log("Slot not correct"); } }
public void UseItemAbility(Inventory_Slot slot) { Item itemToUse = FindItemInSlot(slot); if (itemToUse.GetItemType() == ItemType.Consumable) { if (characterStats.Consume(itemToUse)) { RemoveItemFromInventory(null, WhichInventorySlot(slot.GetComponentInChildren <InventorySlotIcon>())); } } if (itemToUse.GetEquipmentSlotType() == EquipmentSlotType.RHWeapon) // DO WHEN ADDING NEW SLOTS { Equipment_Slot tempEquipmentSlot = equipmentManager.GetUIRightHand().GetComponent <Equipment_Slot>(); Inventory_Slot tempInventorySlot = uIInventorySlotsIcons[FindItemInBagSlot(itemToUse)].GetComponentInParent <Inventory_Slot>(); uiInventoryManager.SwapEquipmentAndInventory(tempEquipmentSlot, tempInventorySlot); } if (itemToUse.GetEquipmentSlotType() == EquipmentSlotType.BodyArmour) { Equipment_Slot tempEquipmentSlot = equipmentManager.GetUIBodyArmour().GetComponent <Equipment_Slot>(); Inventory_Slot tempInventorySlot = uIInventorySlotsIcons[FindItemInBagSlot(itemToUse)].GetComponentInParent <Inventory_Slot>(); uiInventoryManager.SwapEquipmentAndInventory(tempEquipmentSlot, tempInventorySlot); } }
private EquipmentSlotType WhichEquipmentSlot(Equipment_Slot theSlot) { return(theSlot.GetEquipmentSlotType()); }