Ejemplo n.º 1
0
    /**********************************************************
    *   NAME:           CheckMatch
    *  DESCRIPTION:	Checks to see if the two selected cards
    *                   match. ifThey match then play a sound
    *                   effect and a pop up box that say they
    *                   match. If not then play a sound effect
    *                   and a pop up box saying they don't match
    *
    * ********************************************************/
    private IEnumerator CheckMatch()
    {
        yield return(new WaitForSeconds(2.5f));

        if (secondCard.Image == firstCard.Image)
        {
            this.GetComponent <ControlStart>().PlaySoundEffects(true);

            EditorUtility.DisplayDialog("Match", "Its a match", "Okay");

            ++control.Matchs;

            scoreLabel.text = "Matchs: " + control.Matchs;

            CheckWinConditions();
        }
        else
        {
            this.GetComponent <ControlStart>().PlaySoundEffects(false);

            EditorUtility.DisplayDialog("Miss Match", "Its a miss match", "Okay");

            secondCard.FlipFaceDown();
            firstCard.FlipFaceDown();

            ++control.MissMatchs;

            missLabel.text = "Miss: " + control.MissMatchs;

            yield return(new WaitForSeconds(1.5f));
        }

        secondCard = null;
        firstCard  = null;

        checkingMatch = false;
    }