public void OnDrag(PointerEventData eventData) { if (!Draggable) { return; } DropView drop = null; List <GameObject> hovered = eventData.hovered; GameObject hover; for (int i = 0; i < hovered.Count && drop == null; i++) { hover = hovered[i]; drop = hover.GetComponent <DropView>(); drop = (drop != null && drop != this && drop.Droppable) ? drop : null; } if (currentDropView != null && drop != currentDropView) { currentDropView.Highlight(false); } currentDropView = null; if (drop != null && drop.Droppable) { currentDropView = drop; drop.Highlight(true); } SetDraggedPosition(eventData); }
public void OnEndDrag() { int player = -1; Drop drop = Drop.Nothing; int targetIndex = -1; if (currentDropView != null) { drop = currentDropView.DropEnum; targetIndex = currentDropView.DropIndex; currentDropView.Highlight(false); player = currentDropView.PlayerNumber; } PlayableColor(true); PlayerController.LocalPlayer.UseCard(index, player, drop, targetIndex); currentDropView = null; SetVisibility(true); Destroy(ghostCard); CurrentCardView = null; }