Пример #1
0
    public bool flipCard(CardHandler card)
    {
        if (!firstCard)
        {
            firstCard = card;
            return(true);
        }
        if (!secondCard)
        {
            secondCard = card;
            if (firstCard.compare(secondCard))
            {
                firstCard.isMatched  = true;
                secondCard.isMatched = true;
                //success
                //disable their flip


                firstCard  = null;
                secondCard = null;

                if (isWon())
                {
                    Debug.Log("Won All!");
                    //won sound?
                    StartCoroutine(doWin());
                }
            }
            else
            {
                StartCoroutine(doWrongPair());
                //error noise, flip back, delay
            }
            return(true);
        }
        return(false);
    }