TLDR: I want to drop an item in either the left hand slot or the right hand slot, get the name of the slot i dropped the item in, then pass the value to another system. Below is the code, which is from a characterEquipper script derived from Equipper, like in the demo character equipper.
The code is treating whatever hand i drop the item in as the "Right hand", and the second item i drop in the remaining hand as "Left Hand". It doesn't matter if i drop it in the left hand slot, or the right hand slot. I am about 2 days into using the system, so it may be something stupid, or i could be doing this the wrong way. But i need some way to get the proper hand to build the logic around. I want to get the slot currently used, and the weapon to be equipped (not just index 0's slot).
Code:
public override bool Equip(Item item, int index)
{
var result = base.Equip(item, index);
var Slotsx = m_Slots[index];
vWeapon = item.GetItemObjectAt(index).GetComponentInChildren<vMeleeWeapon>();
if (Slotsx.Name.Contains("Right Hand"))
{
Debug.Log("EQUIP RIGHT HAND");
meleeManager.SetRightWeapon(vWeapon);
}
if (Slotsx.Name.Contains("Left Hand"))
{
Debug.Log("EQUIP LEFT HAND");
meleeManager.SetLeftWeapon(vWeapon);
}
}
The code is treating whatever hand i drop the item in as the "Right hand", and the second item i drop in the remaining hand as "Left Hand". It doesn't matter if i drop it in the left hand slot, or the right hand slot. I am about 2 days into using the system, so it may be something stupid, or i could be doing this the wrong way. But i need some way to get the proper hand to build the logic around. I want to get the slot currently used, and the weapon to be equipped (not just index 0's slot).