Ejemplo n.º 1
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (!enabled)
        {
            return;
        }

        _dragging = false;
        _cardObject.PositionDamp = _oldPositionDamp;

        if (DropArea != null)
        {
            var dropArea = DropArea;
            DropArea.OnExit();
            DropArea = null;

            var cardInstance = MatchManager.CurrentMatch.CurrentSide.PutInRow(_cardObject.Card, dropArea.CardType);
            if (cardInstance != null)
            {
                cardInstance.CardObject = _cardObject;
                dropArea.CardSlot.AddCard(_cardObject);
                _cardObject.TargetTransform.rotation = Quaternion.Euler(90, 0, 0);
                return;
            }
        }

        _cardObject.TargetTransform.position = _startPosition;
    }
Ejemplo n.º 2
0
    private void SetDropArea(DropArea newArea)
    {
        DropArea oldArea = DropArea;

        if (newArea == oldArea)
        {
            return;
        }

        if (oldArea != null)
        {
            oldArea.OnExit();
        }

        if (newArea != null)
        {
            bool canDrop = MatchManager.CurrentMatch.CurrentSide.CanPutInRow(_cardObject.Card, newArea.CardType);
            newArea.OnEnter(canDrop);
        }

        DropArea = newArea;
    }