void SeleccionaObjetos() { MotorInferencia.DeterminarObjetivo(); objetoObjetivo = MotorInferencia.Objetivo(); colorObjetivo = MotorInferencia.Color(); tieneColores = MotorInferencia.TieneColores(); nivel = MotorInferencia.nivel; dificultad = MotorInferencia.dificultad; nivelLabel.GetComponent <Text>().text = string.Format("N: {0}, D: {1}", nivel + 1, dificultad + 1); switch (objetoObjetivo) { case Objeto.Paleta: if (tieneColores) { objetivoPaleta.GetComponent <Renderer>().material.color = DecodificadorDeColor.decodificar(colorObjetivo); } Destroy(objetivoPaletaDeHielo); Destroy(objetivoChocolate); break; case Objeto.PaletaDeHielo: if (tieneColores) { objetivoPaletaDeHielo.GetComponent <Renderer>().materials[1].color = DecodificadorDeColor.decodificar(colorObjetivo); } Destroy(objetivoPaleta); Destroy(objetivoChocolate); break; default: if (tieneColores) { objetivoChocolate.GetComponent <Renderer>().material.color = DecodificadorDeColor.decodificar(colorObjetivo); } Destroy(objetivoPaleta); Destroy(objetivoPaletaDeHielo); break; } switch (MotorInferencia.nivel) { case 0: audioSource.clip = AudioN1; Destroy(Canasta); break; case 1: audioSource.clip = AudioN2; Destroy(Canasta); break; default: audioSource.clip = AudioN3; break; } audioSource.Play(); }
public static void DeterminarObjetivo() { float[] Cuartiles = new float[3]; float PromedioJugador = 0; PartidaDAO partidaDAO = new PartidaDAO(); partidaDAO.CalcularMetricas(Cuartiles); PromedioJugador = partidaDAO.CalcularMetricaJugador(); Debug.Log(string.Format("Cuartil 1: {0}, Cuartil 3: {1}, Promedio Jugador: {2}", Cuartiles[0], Cuartiles[2], PromedioJugador)); if (PromedioJugador < Cuartiles[0]) { dificultad = 0; } else if (PromedioJugador > Cuartiles[0] && PromedioJugador <= Cuartiles[2]) { dificultad = 1; } else { dificultad = 2; } nivel = Random.Range(0, 3); //dificultad = Random.Range(0, 3); objetivo = (Objeto)Random.Range(0, 3); colorObjeto = (ColorObjeto)Random.Range(0, 3); for (int i = 0; i < cantidadObjetos.Length; i++) { cantidadObjetos[i] = Random.Range(3, CANTIDAD_OBJETOS[dificultad]); } for (int i = 0; i < objetos.GetLength(0); i++) { int max = cantidadObjetos[i]; int generados = 0; for (int j = 0; j < objetos.GetLength(1); j++) { if (i == (int)objetivo && j == (int)colorObjeto) { objetos[i, j] = Random.Range(1, /*max - generados*/ 1); } else { objetos[i, j] = Random.Range(0, max - 1 - generados); } generados += objetos[i, j]; } objetos[i, 0] += max - generados; } IteradorDeColores = new IteradorDeColores(objetos); }
public static UnityEngine.Color decodificar(ColorObjeto ColorObjeto) { switch (ColorObjeto) { case ColorObjeto.Azul: return(AZUL); case ColorObjeto.Rosa: return(ROSA); default: return(BLANCO); } }
// Start is called before the first frame update void Start() { //ColorObjeto colorObjeto = (ColorObjeto) Random.Range(0, 3); Objeto objeto; //Debug.Log(gameObject.name); System.Enum.TryParse <Objeto>(gameObject.name, out objeto); ColorObjeto colorObjeto = MotorInferencia.IteradorDeColores.Siguiente(objeto); TieneColores = MotorInferencia.TieneColores(); if (objeto == Objeto.PaletaDeHielo) { GetComponent <Renderer>().materials[1].color = DecodificadorDeColor.decodificar(colorObjeto); } else { GetComponent <Renderer>().material.color = DecodificadorDeColor.decodificar(colorObjeto); } }