Exemplo n.º 1
0
 public void OnDrop(PointerEventData ped)
 {
     if (dragging && ped.pointerCurrentRaycast.gameObject == dropZone.gameObject)
     {
         OnDropped?.Invoke();
     }
 }
Exemplo n.º 2
0
    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
    }
Exemplo n.º 3
0
    //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;
        }
    }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
 public void OnEndDrag(PointerEventData ped)
 {
     GetComponent <CanvasGroup>().blocksRaycasts = true;
     transform.position = originalPos;
     OnDropped?.Invoke(ped);
 }
Exemplo n.º 6
0
 public void OnDrop(PointerEventData eventData)
 {
     OnDropped?.Invoke(this);
 }
Exemplo n.º 7
0
 public void Drop()
 {
     _inputComponent = null;
     OnDropped?.Invoke();
 }