Exemple #1
0
    public void UpdateCardsInHand(CardsInHand handCards, GameObject[] cardUIs)  //Update UI for displaying hand cards
    {
        List <Card> mCards = new List <Card>();

        mCards = handCards.GetCards();

        int playerScoreInt = handCards.score;           //Setting the player score int

        playerScore = playerScoreInt.ToString();        //Converting the int to string so we can change the Score in TMPGUI

        if (mCards.Count == 9)
        {
            cardUIs[8].gameObject.SetActive(true);
        }
        else
        {
            cardUIs[8].gameObject.SetActive(false);
        }
        for (int i = 0; i < mCards.Count(); i++)
        {
            TextMeshProUGUI valueText = cardUIs[i].transform.GetChild(0).GetComponent <TextMeshProUGUI>();
            TextMeshProUGUI suitText  = cardUIs[i].transform.GetChild(1).GetComponent <TextMeshProUGUI>();

            suitText.text  = mCards[i].Suit.ToString();
            valueText.text = mCards[i].Value.ToString();
        }
    }
Exemple #2
0
    public void UpdateAICardsInHand(CardsInHand handCards, GameObject[] cardUIs)  //Update UI for displaying AI hand cards
    {
        List <Card> mCards = new List <Card>();

        mCards = handCards.GetCards();
        int aiScoreInt = handCards.score;

        aiScore = aiScoreInt.ToString();

        if (mCards.Count == 9)
        {
            cardUIs[8].gameObject.SetActive(true);
        }
        else
        {
            cardUIs[8].gameObject.SetActive(false);
        }

        for (int i = 0; i < mCards.Count(); i++)
        {
            TextMeshProUGUI valueText = cardUIs[i].transform.GetChild(0).GetComponent <TextMeshProUGUI>();
            TextMeshProUGUI suitText  = cardUIs[i].transform.GetChild(1).GetComponent <TextMeshProUGUI>();

            suitText.text  = mCards[i].Suit.ToString();
            valueText.text = mCards[i].Value.ToString();
        }

        handCards.AnalyseHand(computerCardsInHand);
        int.TryParse(aiScore, out handCards.score);
    }
Exemple #3
0
    public void DetectSelection()   //Allow the player to select interactable game objects in the scene
    {
        if (mEventSystem.currentSelectedGameObject != null)
        {
            if (mEventSystem.currentSelectedGameObject.layer != 5)
            {
                currentSelect = mEventSystem.currentSelectedGameObject;
            }

            if (mEventSystem.currentSelectedGameObject.CompareTag("HeldCard"))
            {
                deckToDraw = CherkiMachineState.SourceDeck.None;

                for (int i = 0; i < displayCards.Count(); i++)
                {
                    if (displayCards[i] == mEventSystem.currentSelectedGameObject)
                    {
                        cardToDiscard = playerCardsInHand.GetCards()[i];
                    }
                }
            }

            if (mEventSystem.currentSelectedGameObject.CompareTag("LastDiscard"))
            {
                cardToDiscard = null;
                deckToDraw    = CherkiMachineState.SourceDeck.DiscardDeck;
            }

            if (mEventSystem.currentSelectedGameObject.CompareTag("DrawDeck"))
            {
                cardToDiscard = null;
                deckToDraw    = CherkiMachineState.SourceDeck.DrawDeck;
            }
        }
    }