Ejemplo n.º 1
0
    IEnumerator ResultAnimation(GameObject resImg)
    {
        resultPerRound.SetActive(true);
        resImg.SetActive(true);
        scoring.UpdateScore();
        resImg.transform.localScale = Vector2.zero;
        LeanTween.scale(resImg.GetComponent <RectTransform>(), Vector2.one, 0.5f);
        yield return(new WaitForSeconds(1.5f));

        LeanTween.scale(resImg.GetComponent <RectTransform>(), Vector2.zero, 0.5f);
        yield return(new WaitForSeconds(0.5f));

        resImg.SetActive(false);
        resultPerRound.SetActive(false);

        if ((scoring.correctScore + scoring.falseScore) >= 10)
        {
            finalResultPanel.SetActive(true);
            PasangResult result = finalResultPanel.GetComponentInChildren <PasangResult> ();
            //result.FinalResult(scoring.correctScore);
            StartCoroutine(result.CoFinalResult(scoring.correctScore));
        }
    }
    private IEnumerator CheckTheAnswer()
    {
        isChecking = true;

        if (flipped[0].hijaiyahContainer.sprite == flipped[1].hijaiyahContainer.sprite)
        {
            correctlyAnswered++;
            yield return(new WaitForSeconds(1f));

            flipped.Clear();
            if (correctlyAnswered == hijaiyahChoosen.Length)
            {
                if (indexQuestion < 4)
                {
                    print("Correct");
                    StartCoroutine(ResultCorrect());
                }
                else
                {
                    finalResult.SetActive(true);
                    PasangResult result = finalResult.GetComponentInChildren <PasangResult>();
                    StartCoroutine(result.CoFinalResult(10));
                    print("GameOver");
                }
            }
        }
        else
        {
            flipped[0].CloseCard();
            flipped[1].CloseCard();
            yield return(new WaitForSeconds(1.5f));

            print("False");
        }

        isChecking = false;
    }