//// Instancia el puntaje y audio, al validar por boton
    void SetPuntaje()
    {
        Element.GetComponent <M10L33_element>().GetQuestion();
        if (_TypeCalification == TypeCalification.grupo)
        {
            if (rights == _groupToggle.Count)
            {
                background.SetActive(false);
                rightImage.SetActive(true);
                _controlAudio.PlayAudio(1);
                _validarBTN.gameObject.SetActive(false);
                _general.AddGifts(level);
                _controlPuntaje.IncreaseScore();
            }
            else
            {
                background.SetActive(false);
                wrongImag.SetActive(true);
                _controlAudio.PlayAudio(2);
                _validarBTN.gameObject.SetActive(false);
                _general.RestLifes();
            }
        }

        //_controlAudio.PlayAudio(rights == _groupToggle.Count ? 1 : 2);
        else
        {
            if (rights == 1)
            {
                background.SetActive(false);
                rightImage.SetActive(true);
                _controlAudio.PlayAudio(1);
                _validarBTN.gameObject.SetActive(false);
                _general.AddGifts(level);
                _controlPuntaje.IncreaseScore();
            }
            else
            {
                _controlAudio.PlayAudio(2);
                _validarBTN.gameObject.SetActive(false);
                _general.RestLifes();
            }
        }

        //_controlAudio.PlayAudio(rights == _groupToggle[0]._sizeCorrect ? 1 : 2);

        //_controlPuntaje.IncreaseScore(rights);

//        StartCoroutine(a());
    }
示例#2
0
    public void CalificarInputs()
    {
        botonValidar.interactable = false;
        _controlAudio.PlayAudio(0);

        int[] contadorTemp = new int[_groupInputField.Count];

        for (int i = 0; i < _groupInputField.Count; i++)
        {
            foreach (var input in _groupInputField[i]._inputFields)
            {
                input.interactable = false;
                input.GetComponent <M10L33_inputField>()._isEnabled = false;
                bool answer = (input.GetComponent <M10L33_inputField>().respuestaCorrecta.Contains(input.GetComponent <InputField>().text));

                switch (calificacion)
                {
                case TipoCalificacion.texto: TipoCalificationTexto(); break;

                case TipoCalificacion.fondo: TipoCalificationFondo(); break;

                case TipoCalificacion.simbolo: TipoCalificationSimbolo(); break;

                case TipoCalificacion.multiple: _FunctionMultiple.Invoke(); break;
                }

                if (answer)
                {
                    contadorTemp[i]++;
                }
            }
        }

        int groupTemp = 0;

        for (int i = 0; i < _groupInputField.Count; i++)
        {
            if (contadorTemp[i] == _groupInputField[i]._inputFields.Count)
            {
                groupTemp++;
            }
        }



/*
 *      if (_TipoPuntuacion == TipoPuntuacion.grupo)
 *          _controlPuntaje.IncreaseScore(groupTemp);
 *      else
 *      {
 *          int total = 0;
 *
 *          foreach (var grupoAnswers in contadorTemp)
 *              total += grupoAnswers;
 *
 *          print(total);
 *
 *          _controlPuntaje.IncreaseScore(total);
 *      }*/


        // _controlAudio.PlayAudio(groupTemp == _groupInputField.Count ? 1 : 2);

        if (groupTemp == _groupInputField.Count)
        {
            _controlAudio.PlayAudio(1);
            _general.AddGifts(level);
            _controlPuntaje.IncreaseScore();
            StartCoroutine(x(true));
        }
        else
        {
            _controlAudio.PlayAudio(2);


            StartCoroutine(x(false));
        }
    }