Example #1
0
 public void CardRevealed(memoryCard card)
 {
     if (_firstRevealed == null)
     {
         _firstRevealed = card;
     }
     else
     {
         _secondRevealed = card;
         StartCoroutine(CheckMatch());
     }
 }
Example #2
0
    private IEnumerator CheckMatch()
    {
        if (_firstRevealed.id == _secondRevealed.id)
        {
            _score++;
            scoreLabel.text = "Score: " + _score;
        }
        else
        {
            yield return(new WaitForSeconds(.5f));

            _firstRevealed.Unreveal();
            _secondRevealed.Unreveal();
        }
        _firstRevealed  = null;
        _secondRevealed = null;
    }