//------------------------------------------------- private void RemoveMatchingItemTypesFromHand(VRTRIXGloveItemPackage.ItemPackageType packageType, VRTRIXGloveGrab hand) { for (int i = 0; i < hand.AttachedObjects.Count; i++) { VRTRIXGloveItemPacakgeReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <VRTRIXGloveItemPacakgeReference>(); if (packageReference != null) { if (packageReference.itemPackage.packageType == packageType) { GameObject detachedItem = hand.AttachedObjects[i].attachedObject; hand.DetachObject(detachedItem); } } } }
//------------------------------------------------- private VRTRIXGloveItemPackage GetAttachedItemPackage(VRTRIXGloveGrab hand) { GameObject currentAttachedObject = hand.currentAttachedObject; if (currentAttachedObject == null) // verify the hand is holding something { return(null); } VRTRIXGloveItemPacakgeReference packageReference = hand.currentAttachedObject.GetComponent <VRTRIXGloveItemPacakgeReference>(); if (packageReference == null) // verify the item in the hand is matchable { return(null); } VRTRIXGloveItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. return(attachedItemPackage); }