internal void EndDragOutfit(OutfitItem outfitItem, PointerEventData data) { var raycastObj = data.pointerCurrentRaycast.gameObject; if (raycastObj != null && raycastObj.GetComponent <OutfitSlotItem>() != null) { //Update player inventory + update player vehicle weapons var slot = raycastObj.GetComponent <OutfitSlotItem>(); //outfitItem.SetSlot(slot); //Get outfit from Game.Player.Inventory.Outfit Game.Player.ChangeOutfitSlot(outfitItem.Outfit, slot.Placement, slot.PositionIdx); //Get type of slot //Set placement and inventory pos //Update UI outfitItem.Slot = slot; SetOutfitParent(outfitItem, slot.transform); } else { SetOutfitParent(outfitItem, outfitItem.Slot.transform); } outfitItem.GetComponent <CanvasGroup>().blocksRaycasts = true; _isDragging = false; }
internal void DragOutfit(OutfitItem outfitItem, PointerEventData data) { //data.position outfitItem.GetComponent <CanvasGroup>().blocksRaycasts = false; _isDragging = true; StartCoroutine(_DoDragOutfit(outfitItem)); }
private IEnumerator _DoDragOutfit(OutfitItem outfitItem) { SetOutfitParent(outfitItem, transform); while (_isDragging) { outfitItem.transform.position = Input.mousePosition; yield return(null); } }
private void SetOutfitParent(OutfitItem outfitItem, Transform parent) { outfitItem.transform.SetParent(parent, false); outfitItem.transform.localScale = Vector2.one; outfitItem.transform.localPosition = Vector2.one; }