public void OnDrop(PointerEventData eventData) { WearableItemScript script = DragHandler.itemBeingDragged.GetComponent <WearableItemScript> (); if (script.Disenchantable()) { Debug.Log("Dissable"); Destroy(DragHandler.itemBeingDragged); ItemObjInst.GetComponent <ItemObjectInster>().CreatItemObject(3, "Dust", 0, 0, 0, 0, false, false, icon); } }
public void OnDrop(PointerEventData eventData) { //It's checked here if we have an item in the slot already //Default code doesnt allow another item but we will swap the items later. WearableItemScript script = DragHandler.itemBeingDragged.GetComponent <WearableItemScript> (); returnParent = DragHandler.itemBeingDragged.transform.parent; if (script != null) { if (script.Upgradable()) { DragHandler.itemBeingDragged.transform.SetParent(transform); script.Upgrade(); myAnimator.SetBool("upgrade", true); } } }
public void OnPointerClick(PointerEventData eventData) { WearableItemScript wScript = GetComponent <WearableItemScript> (); StackableItemScript sScript = GetComponent <StackableItemScript> (); InspectPanelScript script = GameObject.Find("InspectPanel").GetComponent <InspectPanelScript> (); script.setOnScreen(); if (wScript != null) { script.setGeneral(wScript.getName(), wScript.getIcon()); script.setStats(wScript.getSLot(), wScript.getPrimary(), wScript.getPrimaryVal(), wScript.getStatVal(), wScript.getVitality()); script.setActions(wScript.Upgradable(), wScript.Disenchantable()); } else if (sScript != null) { script.setGeneral(sScript.getName(), sScript.getIcon()); } }
public void OnDrop(PointerEventData eventData) { //It's checked here if we have an item in the slot already //Default code doesnt allow another item but we will swap the items later WearableItemScript script = DragHandler.itemBeingDragged.GetComponent <WearableItemScript> (); if (script != null) { if (!item && script.GetItemSlotType() == WearableItemScript.ItemSlot.Weapon) { //If there's no item in the slot and slot type is equal to its own //set parent of the item to this slots transform. DragHandler.itemBeingDragged.transform.SetParent(transform); } else if (item != null && script.GetItemSlotType() == WearableItemScript.ItemSlot.Weapon) { //Swap places of items in inventory item.transform.SetParent(DragHandler.startParent.transform); DragHandler.itemBeingDragged.transform.SetParent(transform); } } }