public void DeployEffect(bool result, List <GameObject> answerButtons, string answer, GameObject questionType)
    {
        answerResult          = result;
        questionAnswer        = answer;
        questionTypeComponent = questionType;
        ShowAnswer(answerButtons);

        if (result)
        {
            //	GpGotEffect (gpText);
            CorrectAnswerEffect(questionAnswer, answerButtons, questionType);
            AudioEffect(AudioEnum.Correct);
        }
        else
        {
            AudioEffect(AudioEnum.Mistake);
        }
        questionTypeComponent = questionType;
        TweenController.TweenShakePosition(questionTypeComponent.transform, 1.0f, 30.0f, 50, 90f);
    }
Exemplo n.º 2
0
    protected void OnAnswerClick(Button answerButton)
    {
        AudioController.Instance.PlayAudio(AudioEnum.ClickButton);
        string answerclicked = "";

        if (string.IsNullOrEmpty(answerButton.transform.GetChild(0).GetComponent <Text> ().text))
        {
            TweenController.TweenShakePosition(answerButton.transform, 0.5f, 15.0f, 50, 90f);
        }
        else
        {
            Debug.Log(answerButton.name);
            for (int i = 1; i < 12 + 1; i++)
            {
                if (answerButton.name.Equals("output" + i))
                {
                    answerclicked = answerButtons [i - 1].transform.GetChild(0).GetComponent <Text> ().text;
                    answerButtons [i - 1].transform.GetChild(0).GetComponent <Text> ().text = "";
                    answerIdentifier [i].transform.GetChild(0).GetComponent <Text> ().text  = answerclicked;
                }
            }
            CheckAnswerHolder();
        }
    }
Exemplo n.º 3
0
    public void OnSelectionClick(Button letterButton)
    {
        AudioController.Instance.PlayAudio(AudioEnum.ClickButton);

        if (string.IsNullOrEmpty(letterButton.transform.GetChild(0).GetComponent <Text> ().text))
        {
            TweenController.TweenShakePosition(letterButton.transform, 1.0f, 30.0f, 50, 90f);
        }
        else
        {
            answerIdentifier[answerIndex] = letterButton.gameObject;
            answerWrote = "";
            answerButtons [(answerIndex - 1)].GetComponentInChildren <Text>().text
                = letterButton.GetComponentInChildren <Text>().text;
            letterButton.GetComponentInChildren <Text>().text = selectionType == QuestionSystemEnums.SelectionType.Typing
                                ? letterButton.GetComponentInChildren <Text>().text: "";

            for (int j = 0; j < questionAnswer.Length; j++)
            {
                answerWrote += answerButtons [j].transform.GetChild(0).GetComponent <Text> ().text;
            }

            if (answerWrote.Length.Equals(questionAnswer.Length))
            {
                if (answerWrote.ToUpper().Equals(questionAnswer.ToUpper()))
                {
                    CheckAnswer(true);
                }
                else
                {
                    CheckAnswer(false);
                }
            }
            CheckAnswerHolder();
        }
    }