Пример #1
0
    private IEnumerator HideCards()
    {
        if (card1.GetComponentInChildren <Image>().sprite == card2.GetComponentInChildren <Image>().sprite)
        {
            Debug.Log("Match");
            scoreVal += 100;
            score.GetComponent <Text>().text = "Score:" + scoreVal;
        }
        else
        {
            Debug.Log("No match");
            if (scoreVal > 0)
            {
                scoreVal -= 10;
                score.GetComponent <Text>().text = "Score:" + scoreVal;
            }
            yield return(new WaitForSeconds(1.0f));

            card1.back.SetActive(true);
            card2.back.SetActive(true);
        }
        card1 = null;
        card2 = null;
    }