Exemplo n.º 1
0
    public int pointAtCard(GameCursor cursor, List <Card> currentPlayerHand, int pointedCardIndex)
    {
        if (currentPlayerHand.Count > 1)
        {
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                moveArrowPressed    = true;
                auxPointedCardIndex = pointedCardIndex;
                pointedCardIndex    = (pointedCardIndex + 1) % currentPlayerHand.Count;

                currentPlayerHand [pointedCardIndex].transform.localPosition    = new Vector3(currentPlayerHand [pointedCardIndex].transform.localPosition.x - PLAYER.HAND_SPACE_OFFSET_X, currentPlayerHand [pointedCardIndex].transform.localPosition.y);
                currentPlayerHand [auxPointedCardIndex].transform.localPosition = new Vector3(0, 0);
            }
            else if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                moveArrowPressed    = true;
                auxPointedCardIndex = pointedCardIndex;

                if (pointedCardIndex > 0)
                {
                    pointedCardIndex = (pointedCardIndex - 1) % currentPlayerHand.Count;
                }
                else
                {
                    pointedCardIndex = currentPlayerHand.Count - 1;
                }

                currentPlayerHand [pointedCardIndex].transform.localPosition    = new Vector3(currentPlayerHand [pointedCardIndex].transform.localPosition.x - PLAYER.HAND_SPACE_OFFSET_X, currentPlayerHand [pointedCardIndex].transform.localPosition.y);
                currentPlayerHand [auxPointedCardIndex].transform.localPosition = new Vector3(0, 0);
            }

            if (moveArrowPressed)
            {
                cursor.moveCursor(currentPlayerHand [pointedCardIndex]);
                moveArrowPressed = false;
            }
        }

        return(pointedCardIndex);
    }