public void OnBeginDrag(PointerEventData eventData) { if (active) { // SoundManager.instance.PlayClickSound (); itemBeingDragged = this; startPosition = transform.position; GetComponent <CanvasGroup> ().blocksRaycasts = false; } }
public void OnDrop(PointerEventData eventData) { DraggerHandler target = DraggerHandler.itemBeingDragged; if (view.CanDropInSlot(target, this)) { target.Dropped(); target.OnEndDrag(); view.Dropped(target, this); } }
public void OnEndDrag(PointerEventData eventData = null) { if (active) { //SoundController.GetController().PlayClickSound (); itemBeingDragged = null; GetComponent <CanvasGroup> ().blocksRaycasts = true; if (!dropped) { transform.position = startPosition; } else { SetActive(false); } if (dropped && !activeOnDrop) { dropped = false; gameObject.SetActive(false); } } }
abstract public bool CanDropInSlot(DraggerHandler dropper, DraggerSlot slot);
abstract public void Dropped(DraggerHandler dropped, DraggerSlot where);