Exemplo n.º 1
0
    private void OnMouseDown()
    {
        if (deckOfCards.Count != 0)
        {
            checkHandToDraw(userHandRef);

            if (ableToDraw == true)
            {
                userHandRef.SetHandState(UserHand.HandState.DrawCard);
            }

            if (userHandRef.GetHandState() == UserHand.HandState.DrawCard)
            {
                userHandRef.DrawCardInHand(userHandRef.GetCardHand().Count);

                checkHandToDraw(userHandRef);

                if (ableToDraw == true)
                {
                    StartCoroutine(gMRef.AITurn());
                }
                else
                {
                    if (userHandRef.GetCardHand().Count == 2)
                    {
                        gMRef.checkInteractiveButton(true);
                    }
                    userHandRef.SetHandState(UserHand.HandState.PlayCard);
                }
            }
        }
    }
Exemplo n.º 2
0
    private bool checkHandToDraw(UserHand userRef)
    {
        int cardHandCounter = 0;

        bool checkDraw = false;

        for (int i = 0; i < userRef.GetCardHand().Count; i++)
        {
            if (userRef.GetCardHand()[i].GetComponent <CardBehaviour>().GetUniqueCardIDNumber() != pileOfCardsRef.GetCardRef().GetComponent <CardBehaviour>().GetUniqueCardIDNumber() && userRef.GetCardHand()[i].GetComponent <CardBehaviour>().GetUniqueCardIDColor() != pileOfCardsRef.GetCardRef().GetComponent <CardBehaviour>().GetUniqueCardIDColor())
            {
                cardHandCounter++;
            }
        }

        if (cardHandCounter == userRef.GetCardHand().Count&& userRef.GetHandState() != UserHand.HandState.WaitForTurn)
        {
            checkDraw = true;
        }
        else
        {
            checkDraw = false;
        }

        ableToDraw = checkDraw;
        return(ableToDraw);
    }
Exemplo n.º 3
0
    private void OnMouseDown()
    {
        if (cardStateReference != CardState.AICard)
        {
            if (cardStateReference == CardState.CardInHand)
            {
                if (userCardHand.GetHandState() == UserHand.HandState.PlayCard)
                {
                    if (userCardHand.GetDeck().GetComponent <DeckBehaviour>().GetPileOfCards().GetCardRef().GetComponent <CardBehaviour>().GetUniqueCardIDColor() == this.uniqueCardIDColor || userCardHand.GetDeck().GetComponent <DeckBehaviour>().GetPileOfCards().GetCardRef().GetComponent <CardBehaviour>().GetUniqueCardIDNumber() == this.uniqueCardIDNumber)
                    {
                        userCardHand.SetCardSelected(false);
                        if (this.transform.position != originalCardPos)
                        {
                            this.transform.position = originalCardPos;
                        }

                        PlayCard();
                    }
                }
            }
        }
    }