Example #1
0
 public void OnDrag(PointerEventData eventData)
 {
     // If the card target is the play panel, allow the user to drag it around
     if (mCardController.Target == "Play Panel" && IsBeingDrag)
     {
         Vector3 cursorPoint    = new Vector3(Input.mousePosition.x, Input.mousePosition.y, MouseBeginPosition.z);
         Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(cursorPoint) + MouseToScreenOffset;
         transform.position = cursorPosition;
     }
     else if (mCardController.Target == "Enemy" && IsBeingDrag && !IsCursorTarget)
     {
         // If the card target a specific object, lift the card up slightly and draw an arrow from the card to mouse
         Vector3 tCardPosition = transform.position;
         tCardPosition.z    = -300;
         transform.position = tCardPosition;
         mMatchController.ChangeCursorToTarget();
         IsCursorTarget = true;
     }
 }