Exemplo n.º 1
0
        public void dropDragCard()
        {
            if (dragCard == null)
            {
                return;
            }
            Square sq            = getNearestSquare(dragCard.transform.localPosition);
            bool   actionSuccess = false;

            if (dragCard.square.boardLocation == BoardLocationEnum.player1Hand || dragCard.square.boardLocation == BoardLocationEnum.player2Hand)
            {
                actionSuccess = initiateAction(dragCard, sq, BoardActionEnum.deploy);
            }
            else if (dragCard.square.boardLocation == BoardLocationEnum.board)
            {
                actionSuccess = initiateAction(dragCard, sq, BoardActionEnum.movement);
            }
            if (!actionSuccess && dragCard.square != null)
            {
                moveCardToSquare(dragCard, dragCard.square);
            }
            dragCard.GetComponent <SortingGroup>().sortingLayerName = "Default";
            dragCard = null;
            clearHighlightSquares();
        }
Exemplo n.º 2
0
 public void setDragCard(CardInstance newCard)
 {
     if (!allowedToDrag(newCard))
     {
         return;
     }
     if (dragCard == null)
     {
         dragCard = newCard;
         dragCard.GetComponent <SortingGroup>().sortingLayerName = "DragCard";
         if (dragCard.square == null)
         {
         }
         else if (dragCard.square.boardLocation == BoardLocationEnum.board)
         {
             highlightValidSquares(dragCard, BoardActionEnum.movement);
         }
         else if (dragCard.square.boardLocation == BoardLocationEnum.player1Hand || dragCard.square.boardLocation == BoardLocationEnum.player2Hand)
         {
             highlightValidSquares(dragCard, BoardActionEnum.deploy);
         }
     }
 }