public void OnDrop(PointerEventData eventData) { Debug.Log("OnDrop to " + gameObject.name); draggable d = eventData.pointerDrag.GetComponent <draggable>(); if (d != null) { d.parentToReturnTo = this.transform; } }
public void OnDrop(PointerEventData eventData) { Debug.Log(eventData.pointerDrag.name + " was dropped on " + gameObject.name); draggable d = eventData.pointerDrag.GetComponent <draggable> (); if (d != null) { d.oringalParent = this.transform; d.transform.localScale = this.transform.localScale; } }
public void OnPointerExit(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } draggable d = eventData.pointerDrag.GetComponent <draggable>(); if (d != null && d.placeholderParent == this.transform) { d.placeholderParent = d.parentToReturnTo; } }
public void OnPointerEnter(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } draggable d = eventData.pointerDrag.GetComponent <draggable> (); if (d != null) // && (typeOfItem == d.typeOfItem || typeOfItem==draggable.Slot.INVENTORY ) { d.placeholderParent = this.transform; } }
public void OnDrop(PointerEventData eventData) { draggable d = eventData.pointerDrag.GetComponent <draggable>(); if (d != null) { if (typeOfItem == d.typeOfItem) { //d.parentToReturnTo = this.transform; d.newObj.AddComponent <draggable>(); d.newObj.transform.SetParent(this.transform, false); } } }
public void OnPointerEnter(PointerEventData eventData) { //Debug.Log("OnPointerEnter"); if (eventData.pointerDrag == null) { return; } draggable d = eventData.pointerDrag.GetComponent <draggable>(); if (d != null) { d.placeholderParent = this.transform; } }
public void OnDrop(PointerEventData eventData) { //OnDrop cmd triggers before the OnEndDrag does //Debug.Log("OnDrop to " + gameObject.name); Debug.Log(eventData.pointerDrag.name + " was dropped " + gameObject.name); draggable d = eventData.pointerDrag.GetComponent <draggable>(); if (d != null) { //if(typeOfItem == d.typeOfItem || typeOfItem == draggable.Slot.INVENTORY) //{ d.parentToReturnTo = this.transform; //} } }
//public draggable.Slot typeOfItem = draggable.Slot.INVENTORY; public void OnDrop(PointerEventData eventData) { //Debug.Log (eventData.pointerDrag + " OnDrop to " + gameObject.name); draggable d = eventData.pointerDrag.GetComponent <draggable> (); if (d != null && d.tag == gameObject.tag) // && (typeOfItem == d.typeOfItem || typeOfItem==draggable.Slot.INVENTORY ) { d.parentToReturnTo = this.transform; if (gameObject.name == "DropZone") { d.changeSlot(draggable.Slot.REST); Image img = d.GetComponent <Image> (); img.color = Color.red; GameController gamer = gc.GetComponent <GameController>(); gamer.DisabledZaphires(eventData.pointerDrag); } } }