Example #1
0
    // Flip the previous cards and side cards that were already matched!
    private void FlipPreviousCards(List <int> cardsAlreadyRevealed)
    {
        foreach (GameObject obj in _cardsOnBoard)
        {
            Card c = obj.GetComponent <Card>();
            for (int i = 0; i < cardsAlreadyRevealed.Count; i++)
            {
                if (c.GetCardID() == cardsAlreadyRevealed[i])
                {
                    c.RevealCard(true);
                    c.MatchCard();
                }
            }
        }

        foreach (GameObject obj in _cardsOnSideBoard)
        {
            SideCard c = obj.GetComponent <SideCard>();
            for (int i = 0; i < cardsAlreadyRevealed.Count; i++)
            {
                if (c.GetCardID() == cardsAlreadyRevealed[i])
                {
                    c.RevealCard();
                }
            }
        }
    }
Example #2
0
 // Flip side card equal to the 3 recently matched cards
 private void RevealSideCard(int id)
 {
     foreach (GameObject obj in _cardsOnSideBoard)
     {
         SideCard sc = obj.GetComponent <SideCard>();
         if (sc.GetCardID() == id)
         {
             sc.RevealCard();
             break;
         }
     }
 }