void IBeginDragHandler.OnBeginDrag(PointerEventData eventData) { commandBeingDragged = GetComponent <TopCommand> (); commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = false; AttackInstructionPanel.outsidePanel = false; originalSlotHost = commandBeingDragged.GetComponentInParent <AttackTopCommandSlot> (); }
void IEndDragHandler.OnEndDrag(PointerEventData eventData) { if (AttackInstructionPanel.outsidePanel) { originalSlotHost.destructCommand(); } else if (commandBeingDragged.GetComponentInParent <AttackTopCommandSlot> () != originalSlotHost) { TopCommand newC = Instantiate(Resources.Load("NoActionPrefab", typeof(TopCommand))) as TopCommand; newC.transform.SetParent(originalSlotHost.transform); commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = true; } else { commandBeingDragged.transform.localPosition = Vector2.zero; commandBeingDragged.GetComponent <CanvasGroup> ().blocksRaycasts = true; } commandBeingDragged = null; originalSlotHost = null; }