示例#1
0
        /**
         * Funcion que asigna de manera aleatoria los valores de las opciones que estaran disponibles
         */
        public void DefinirOpciones()
        {
            // Definir la cantidad de opciones en base a la dificultad
            if (Jugador.jugador.Dificultad == DificultadEnumerator.OPTOTIPOS_LEIA)
            {
                optotipos = new OptotipoEnum[4];
                opciones [opciones.Count - 1].SetActive(false);
            }
            else if (Jugador.jugador.Dificultad == DificultadEnumerator.OPTOTIPOS_SNELLEN)
            {
                optotipos = new OptotipoEnum[5];
                opciones [opciones.Count - 1].SetActive(true);
            }

            // Obtener un valor aleatorio  para cada opcion
            for (int i = 0; i < optotipos.Length; i++)
            {
                OptotipoEnum optotipoAleatorio = ObtenerOptotipoAleatorio();

                // Verificar si la opcion aun no existe
                if (!YaExisteOpcion(optotipoAleatorio))
                {
                    optotipos [i] = optotipoAleatorio;
                    AsignarValorOptotipo(opciones [i], optotipoAleatorio);
                    AsignarMateriales(opciones[i], optotipoAleatorio);
                    AplicarEscala(opciones [i], Jugador.jugador.partida.distanciaActual, i);
                }
                else
                {
                    // Si la funcion ya existe, se intentara nuevamente
                    i--;
                    continue;
                }
            }
        }
示例#2
0
    public bool EsRespuestaCorrecta(OptotipoEnum respuestaSeleccionada)
    {
        bool resultado = false;

        if (gameOver)
        {
            return(false);
        }

        if (respuestaActual == respuestaSeleccionada)
        {
            Debug.Log("RESPUESTA CORRECTA!!!!");
            resultado = true;
        }
        else
        {
            contadorErrores++;
            Debug.Log("VUELVE A INTENTAR");
        }

        if (contadorErrores >= MAXIMA_ERROR)
        {
            gameOver = true;
        }
        else
        {
            ManejoDeRespuestas(resultado);
        }

        return(resultado);
    }
示例#3
0
 /// <summary>
 /// Compara si el OptotipoEnum que recibe como parametro ya existe dentro del arreglo optotipos
 /// </summary>
 public bool YaExisteOpcion(OptotipoEnum opcion)
 {
     for (int i = 0; i < optotipos.Length; i++)
     {
         if (optotipos [i] == opcion)
         {
             return(true);
         }
     }
     return(false);
 }
示例#4
0
        /// <summary>
        /// Cargar los materiales asociados al  OptotipoEnum y asignarlos al controlador de la opcion
        /// </summary>
        public void AsignarMateriales(GameObject opcion, OptotipoEnum optotipo)
        {
            // Obtenemos el controlador y el rederizador
            OptotipoController controller = opcion.GetComponent <OptotipoController> ();
            Renderer           render     = opcion.GetComponent <Renderer> ();

            // Material cuando no esta siendo observado
            Material inactiveMaterial = Resources.Load("Materials/" + optotipo, typeof(Material)) as Material;

            render.material = inactiveMaterial;

            // Material cuando esta siendo observado
            Material gazedAtMaterial = Resources.Load("Materials/" + optotipo + "_seleccionado", typeof(Material)) as Material;

            // Si el controlador no es nulo, es una de nuestras opciones disponibles
            if (controller != null)
            {
                controller.inactiveMaterial = inactiveMaterial;
                controller.gazedAtMaterial  = gazedAtMaterial;
            }
        }
示例#5
0
        /// <summary>
        /// Asignar el valor del optotipo que representa el objeto en la escena
        /// </summary>
        public void AsignarValorOptotipo(GameObject gameObject, OptotipoEnum optotipo)
        {
            OptotipoController controller = gameObject.GetComponent <OptotipoController> ();

            controller.optotypeValue = optotipo;
        }