private void Update() { var worldMousePos = invCam.ScreenToWorldPoint(Input.mousePosition); worldMousePos.z = 45; if (currentDraggedItem) { if (Input.GetMouseButton(0) || InputManager.AButtonHeld(player.playerId)) { currentDraggedItem.GetChild(0).position = worldMousePos + Vector3.up * currentSlotDraggedYOffset; currentDraggedItem.GetChild(0).Rotate(0, 1, 0, Space.World); } else { if (currentSlotHoverId != -1) { AssetData swapAsset = null; int swapAssetAmount = 0; AssetInventorySlot hover; if (currentSlotHoverId > 31) { hover = currentStorageObject.inventory[currentSlotHoverId - 32]; } else { hover = player.inventory[currentSlotHoverId]; } AssetInventorySlot dragged; if (currentSlotDraggedId > 31) { dragged = currentStorageObject.inventory[currentSlotDraggedId - 32]; } else { dragged = player.inventory[currentSlotDraggedId]; } if (hover.amount > 0) { swapAsset = hover.asset; swapAssetAmount = hover.amount; } hover.asset = dragged.asset; hover.amount = dragged.amount; dragged.asset = swapAsset; dragged.amount = swapAssetAmount; UpdateInventoryRender(); } else { if (currentSlotDraggedId < 32) { currentDraggedItem.GetChild(0).localPosition = new Vector3(0, player.inventory[currentSlotDraggedId].asset.invModelYOffset, 0); } else { currentDraggedItem.GetChild(0).localPosition = new Vector3(0, currentStorageObject.inventory[currentSlotDraggedId - 32].asset.invModelYOffset, 0); } } currentDraggedItem.localScale = Vector3.one * .6f; currentDraggedItem = null; currentSlotDraggedId = -1; } } hotbarItemsParent.GetChild(C.c.player[0].inventoryCurrentIndex).Rotate(0, .3f, 0); assetPreviewItem.Rotate(0, .3f, 0, Space.World); if (inventoryOpen) { inventoryNull.localPosition = Vector3.Lerp(inventoryNull.localPosition, Vector3.up * 1.6f, Time.deltaTime * 12); } else { inventoryNull.localPosition = Vector3.Lerp(inventoryNull.localPosition, Vector3.zero, Time.deltaTime * 8); if (mainInventory.gameObject.activeSelf) { if (inventoryNull.localPosition.y < .1f) { mainInventory.gameObject.SetActive(false); } } } }