public void OnDrop(PointerEventData eventData) { if (!item) { if (transform.childCount == 0) { DragHandler.itemBeingDragged.transform.SetParent(transform); DragHandler.itemBeingDragged.transform.GetComponent <RectTransform>().localScale = new Vector3(0.5f, 0.5f, 0.5f); pieceConnector.CheckLight(); pieceConnector.CountItems(); audioControl.OnDropSound(); } } }
public void OnEndDrag(PointerEventData eventData) { itemBeingDragged = null; GetComponent <CanvasGroup> ().blocksRaycasts = true; cameraScript.isBuilding = false; if (transform.parent == startParent) { transform.position = startPosition; audioControl.OnDropSound(); } else if (transform.parent.tag == "Garbage") { Debug.Log(firstPosition.ToString()); transform.SetParent(firstParent); transform.GetComponent <RectTransform>().anchoredPosition = firstPosition; transform.GetComponent <RectTransform>().sizeDelta = new Vector2(defaultWidth, defaultHeight); pieceConnector.CheckLight(); pieceConnector.CountItems(); audioControl.OnDropSound(); } }