private void RemoveMatchingItemTypesFromHand(ItemPackage.ItemPackageType packageType, Hand hand) { for (int i = 0; i < hand.AttachedObjects.Count; i++) { ItemPackageReference component = hand.AttachedObjects[i].attachedObject.GetComponent <ItemPackageReference>(); if (component != null && component.itemPackage.packageType == packageType) { GameObject attachedObject = hand.AttachedObjects[i].attachedObject; hand.DetachObject(attachedObject, true); } } }
// Token: 0x060020B3 RID: 8371 RVA: 0x000A150C File Offset: 0x0009F70C private ItemPackage GetAttachedItemPackage(Hand hand) { if (hand.currentAttachedObject == null) { return(null); } ItemPackageReference component = hand.currentAttachedObject.GetComponent <ItemPackageReference>(); if (component == null) { return(null); } return(component.itemPackage); }
//------------------------------------------------- private void RemoveMatchingItemTypesFromHand(ItemPackage.ItemPackageType packageType, Hand hand) { for (int i = 0; i < hand.AttachedObjects.Count; i++) { ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <ItemPackageReference>(); if (packageReference != null) { if (packageReference.itemPackage.packageType == packageType) { GameObject detachedItem = hand.AttachedObjects[i].attachedObject; hand.DetachObject(detachedItem); } } } }
//------------------------------------------------- private void RemoveMatchingItemsFromHandStack(ItemPackage package, Hand hand) { for (int i = 0; i < hand.AttachedObjects.Count; i++) { ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <ItemPackageReference>(); if (packageReference != null) { ItemPackage attachedObjectItemPackage = packageReference.itemPackage; if ((attachedObjectItemPackage != null) && (attachedObjectItemPackage == package)) { GameObject detachedItem = hand.AttachedObjects[i].attachedObject; hand.DetachObject(detachedItem); } } } }
//------------------------------------------------- // private void HandHoverUpdate( Hand hand ) // { // if ( takeBackItem && requireReleaseActionToReturn ) // { // if (hand.isActive) // { // ItemPackage currentAttachedItemPackage = GetAttachedItemPackage( hand ); // if (currentAttachedItemPackage == itemPackage && // // hand.IsGrabEnding(currentAttachedItemPackage.gameObject) // hand.GetGrabUp() // ) // { // TakeBackItem( hand ); // return; // So that we don't pick up an ItemPackage the same frame that we return it // } // } // } // if ( requireGrabActionToTake ) // { // // GrabTypes startingGrab = hand.GetGrabStarting(); // // if (startingGrab != GrabTypes.None) // if (hand.GetGrabDown()) // { // SpawnAndAttachObject( hand);//, GrabTypes.Scripted); // } // } // } //------------------------------------------------- // private void OnHandHoverEnd( Hand hand ) // { // // if ( !justPickedUpItem && requireGrabActionToTake && showTriggerHint ) // // { // // hand.HideGrabHint(); // // } // justPickedUpItem = false; // } //------------------------------------------------- // private void RemoveMatchingItemsFromHandStack( ItemPackage package, Hand hand ) // { // if (hand == null) // return; // if (hand.currentAttached == null) // return; // // if (!hand.hasCurrentAttached) // // return; // // for ( int i = 0; i < hand.AttachedObjects.Count; i++ ) // // { // // ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent<ItemPackageReference>(); // ItemPackageReference packageReference = hand.currentAttached.attachedObject.GetComponent<ItemPackageReference>(); // if ( packageReference != null ) // { // ItemPackage attachedObjectItemPackage = packageReference.itemPackage; // if ( ( attachedObjectItemPackage != null ) && ( attachedObjectItemPackage == package ) ) // { // // GameObject detachedItem = hand.AttachedObjects[i].attachedObject; // GameObject detachedItem = hand.currentAttached.attachedObject; // hand.DetachObject( detachedItem ); // } // } // // } // } private void RemoveMatchingItemsFromHandStack(ItemPackage package, Inventory inventory) { for (int i = 0; i < inventory.equippedSlots.Length; i++) { if (inventory.equippedSlots[i] != null) { ItemPackageReference packageReference = inventory.equippedSlots[i].sceneItem.GetComponent <ItemPackageReference>(); if (packageReference != null) { ItemPackage attachedObjectItemPackage = packageReference.itemPackage; if ((attachedObjectItemPackage != null) && (attachedObjectItemPackage == package)) { inventory.UnequipItem(i, false); } } } } // if (inventory.equippedItem == null) // return; // // if (!hand.hasCurrentAttached) // // return; // // for ( int i = 0; i < hand.AttachedObjects.Count; i++ ) // // { // // ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent<ItemPackageReference>(); // ItemPackageReference packageReference = inventory.equippedItem.item.GetComponent<ItemPackageReference>(); // if ( packageReference != null ) // { // ItemPackage attachedObjectItemPackage = packageReference.itemPackage; // if ( ( attachedObjectItemPackage != null ) && ( attachedObjectItemPackage == package ) ) // { // // GameObject detachedItem = hand.AttachedObjects[i].attachedObject; // // GameObject detachedItem = inventory.equippedItem.attachedObject; // inventory.UnequipItem( inventory.equippedItem.item ); // } // } // // } }
//------------------------------------------------- private ItemPackage GetAttachedItemPackage(Hand hand) { GameObject currentAttachedObject = hand.currentAttachedObject; if (currentAttachedObject == null) // verify the hand is holding something { return(null); } ItemPackageReference packageReference = hand.currentAttachedObject.GetComponent <ItemPackageReference>(); if (packageReference == null) // verify the item in the hand is matchable { return(null); } ItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. return(attachedItemPackage); }
// private void TakeBackItem( Hand hand ) // { // RemoveMatchingItemsFromHandStack( itemPackage, hand ); // if ( itemPackage.packageType == ItemPackage.ItemPackageType.TwoHanded ) // { // RemoveMatchingItemsFromHandStack( itemPackage, hand.otherHand ); // } // } //------------------------------------------------- // private ItemPackage GetAttachedItemPackage( Hand hand ) // { // // GameObject currentAttachedObject = hand.currentAttachedObject; // // if ( currentAttachedObject == null ) // verify the hand is holding something // // if (!hand.hasCurrentAttached) // if (hand.currentAttached == null) // { // return null; // } // GameObject currentAttachedObject = hand.currentAttached.attachedObject; // ItemPackageReference packageReference = currentAttachedObject.GetComponent<ItemPackageReference>(); // if ( packageReference == null ) // verify the item in the hand is matchable // { // return null; // } // ItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. // return attachedItemPackage; // } private ItemPackage GetAttachedItemPackage(Inventory inventory) { for (int i = 0; i < inventory.equippedSlots.Length; i++) { if (inventory.equippedSlots[i] != null) { ItemPackageReference packageReference = inventory.equippedSlots[i].sceneItem.GetComponent <ItemPackageReference>(); if (packageReference == null) // verify the item in the hand is matchable { continue; // return null; } ItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. return(attachedItemPackage); } } return(null); // // GameObject currentAttachedObject = hand.currentAttachedObject; // // if ( currentAttachedObject == null ) // verify the hand is holding something // // if (!hand.hasCurrentAttached) // if (inventory.equippedItem == null) // { // return null; // } // GameObject currentAttachedObject = inventory.equippedItem.item.gameObject; // ItemPackageReference packageReference = currentAttachedObject.GetComponent<ItemPackageReference>(); // if ( packageReference == null ) // verify the item in the hand is matchable // { // return null; // } // ItemPackage attachedItemPackage = packageReference.itemPackage; // return the ItemPackage reference we find. // return attachedItemPackage; }