Exemple #1
0
    void Update()
    {
        if (!IsMyTurn || !Interactable)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            PointerEventData pointerData = new PointerEventData(EventSystem.current);

            pointerData.position = Input.mousePosition;

            List <RaycastResult> results = new List <RaycastResult>();
            EventSystem.current.RaycastAll(pointerData, results);

            if (results.Count > 0)
            {
                Card card = results[0].gameObject.GetComponent <Card>();
                if (card != null && MyCards.Contains(card))
                {
                    CardTapped(card);
                }
            }
        }
    }
 //Used to build up a hand of cards
 void AddCardToHand(string card)
 {
     if (!MyCards.Contains(card))
     {
         MyCards.Add(card);
     }
     else
     {
         //Can't place 2 of the same card in your hand
         MessageBox.Show($"Add Card Command Failed: " + card + " was already in your hand ");
     }
 }