public void OnDrop(PointerEventData ped) { if (dragging && ped.pointerCurrentRaycast.gameObject == dropZone.gameObject) { OnDropped?.Invoke(); } }
private void OnMouseUp() { isBeingDragged = false; dragged = null; OnDropped?.Invoke(this); if (placementLocationQueue.Count == 0 || !placementLocationQueue[0].CanBePlaced(this)) //If it can't be placed where it is, either due to being off-screen or over an unacceptable location { currentPlacementLocation.PlaceBack(this); //Place it back where it was, even if it's an unacceptable place } else { placementLocationQueue[0].Place(this); currentPlacementLocation = placementLocationQueue[0]; } placementLocationQueue = new List <IPlacementLocation>(); //Resets the queue }
//When the object is let go, stop dragging it private void OnMouseUp() { OnDropped?.Invoke(this); xzabb.ClearCheckAgainst(); isPickedUp = false; if (prospectivePL != currentPL) { prospectivePL.PlacePickUpable(this); currentPL.RemovePickUpable(this); currentPL = prospectivePL; } else { transform.localPosition = Vector3.zero; } }
private void OnMouseUp() { _dragging = false; transform.localScale = Vector3.one; _material.SetFloat("_Highlight", 0f); _collider.enabled = true; Chest.Instance.Close(); if (Chest.Instance.IsHovered()) { Player.Instance.AddTreasure(); OnCollected?.Invoke(); Free(); } else { OnDropped?.Invoke(); } }
public void OnEndDrag(PointerEventData ped) { GetComponent <CanvasGroup>().blocksRaycasts = true; transform.position = originalPos; OnDropped?.Invoke(ped); }
public void OnDrop(PointerEventData eventData) { OnDropped?.Invoke(this); }
public void Drop() { _inputComponent = null; OnDropped?.Invoke(); }