public void OnDrag(Puzzle puzzle)
    {
        if (overlappedSlots.Count == 0)
        {
            if (lastSlot != null)
            {
                SetAlpha(0f);
                lastSlot = null;
            }
            return;
        }

        var slot = DragHelper.GetClosestSlot(puzzle, overlappedSlots);

        MoveHighlightTo(slot);

        lastSlot = slot;
    }
Beispiel #2
0
    public void OnDrop(Puzzle puzzle, Vector2 dragPosition)
    {
        foreach (var listener in dropListeners)
        {
            listener.OnDrop(puzzle);
        }

        if (overlappedSlots.Count == 0)
        {
            return;
        }

        Slot slot = DragHelper.GetClosestSlot(puzzle, overlappedSlots);

        if (Match(puzzle, slot))
        {
            Success(puzzle, slot);
        }
        else
        {
            Failure(puzzle, slot);
        }
    }