Exemplo n.º 1
0
    private IEnumerator CheckMatch()
    {
        if (_firstRevealed.GetComponent <TextMesh>().text == Antwoord)
        {
            if (Animations.GetInteger("Reaction") == 0)
            {
                Animations.SetInteger("Reaction", 1);
            }
            else
            {
                Animations.SetInteger("Reaction", 2);
            }
            LeftArm.SetInteger("Antwoord", 1);

            StartCoroutine(ArmsMovementTrue());
            yield return(new WaitForSeconds(0.4f));

            LeftArm.SetInteger("Antwoord", 0);

            _NameObject.tag = "Respawn";
            GameObject[] TextClone = GameObject.FindGameObjectsWithTag("Respawn");
            RandomTrueMatch();
            _score++;
            TotalScore.GetComponent <TextMesh>().text = "Score: " + _score;

            StopAllCoroutines();


            if (_score == 4)
            {
                winText.SetActive(true);
                winText.transform.position -= new Vector3(0.00f, 0.00f, 5.0f);
                if (targetObject != null)
                {
                    targetObject.SendMessage(targetMessage);
                }
                Destroy(originalCard);
                Destroy(TextClone[0]);
                Destroy(TextClone[1]);
                Destroy(TextClone[2]);
                Destroy(Namen);
                StartCoroutine(StopBang());
                Victory();
            }
            else
            {
                Debug.Log("bye");
                _firstRevealed.Unreveal();
                Destroy(TextClone[0]);
                Destroy(TextClone[1]);
                Destroy(TextClone[2]);
                begin();
                yield return(new WaitForEndOfFrame());
            }
        }
        else
        {
            FoutAntwoord.Play();
            Animations.SetInteger("Reaction", 0);
            falseMatch.Play();
            _firstRevealed.Unreveal();
            yield return(new WaitForSeconds(0.2f));

            StartCoroutine(_firstRevealed.AnimatieColorUnReveal());
            StartCoroutine(_firstRevealed.AnimatieUnReveal());
        }

        _firstRevealed = null;
    }