private void bloqueDerecho() { float posicionBloqueH = 0; switch (tipoMenuDerecho) { case tMenuDerecho.ninguno: break; case tMenuDerecho.filtroAnimales: switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 8.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 11; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 16; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 28 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoFiltroAnimales"); togglesFiltros[19] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 4, cuantoW * 2, cuantoH * 2), togglesFiltros[19], new GUIContent ("", "Filtrar los zorros"), "BotonInsertarCarnivoro1"); togglesFiltros[20] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 7, cuantoW * 2, cuantoH * 2), togglesFiltros[20], new GUIContent ("", "Filtrar los lobos"), "BotonInsertarCarnivoro2"); togglesFiltros[21] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[21], new GUIContent ("", "Filtrar los tigres"), "BotonInsertarCarnivoro3"); togglesFiltros[22] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 13, cuantoW * 2, cuantoH * 2), togglesFiltros[22], new GUIContent ("", "Filtrar los osos"), "BotonInsertarCarnivoro4"); togglesFiltros[23] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 16, cuantoW * 2, cuantoH * 2), togglesFiltros[23], new GUIContent ("", "Filtrar los tiranosaurios"), "BotonInsertarCarnivoro5"); togglesFiltros[14] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 4, cuantoW * 2, cuantoH * 2), togglesFiltros[14], new GUIContent ("", "Filtrar los insectos herbivoros."), "BotonInsertarHerbivoro1"); togglesFiltros[15] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 7, cuantoW * 2, cuantoH * 2), togglesFiltros[15], new GUIContent ("", "Filtrar los peque\u00f1os roedores."), "BotonInsertarHerbivoro2"); togglesFiltros[16] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[16], new GUIContent ("", "Filtrar los vacunos."), "BotonInsertarHerbivoro3"); togglesFiltros[17] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 13, cuantoW * 2, cuantoH * 2), togglesFiltros[17], new GUIContent ("", "Filtrar los herbivoros de la sabana."), "BotonInsertarHerbivoro4"); togglesFiltros[18] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 16, cuantoW * 2, cuantoH * 2), togglesFiltros[18], new GUIContent ("", "Filtrar las tortugas gigantes."), "BotonInsertarHerbivoro5"); if (GUI.Button (new Rect (cuantoW * 2, cuantoH * 23, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Desactivar filtros de Carnivoros"), "BotonFiltroAnimalesOffCarnivoros")) { for (int i = 0; i< materiales.carnivoros.Count; i++){ if (materiales.carnivoros[i] != null) { materiales.carnivoros[i].SetFloat("_FiltroOn",0.0f); materiales.carnivoros[i].SetColor("_Tinte",Color.white); } } for (int i = 19; i <= 23; i++) { togglesFiltros[i] = false; } GUI.changed = true; } if (GUI.Button (new Rect (cuantoW * 7, cuantoH * 23, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Desactivar filtros de Herbivoros"), "BotonFiltroAnimalesOffHerbivoros")) { for (int i = 0; i< materiales.herbivoros.Count; i++){ if (materiales.herbivoros[i] != null) { materiales.herbivoros[i].SetFloat("_FiltroOn",0.0f); materiales.herbivoros[i].SetColor("_Tinte",Color.white); } } for (int i = 14; i <= 18; i++) { togglesFiltros[i] = false; } GUI.changed = true; } GUI.EndGroup (); //TODO Botones de filtros de animales if (GUI.Button (new Rect (79 * cuantoW, posicionBloqueH * cuantoH, cuantoW, cuantoH), "", "BotonCerrar")) { tipoMenuDerecho = tMenuDerecho.ninguno; } break; case tMenuDerecho.filtroRecursos: switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 16; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 18.5f; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 23.5f; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 13 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 13 * cuantoH), "", "BloqueDerechoFiltroRecursos"); togglesFiltros[0] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 6, cuantoW * 2, cuantoH * 2), togglesFiltros[0], new GUIContent ("", "Muestra los minerales comunes"), "BotonFiltroRecursosMineralComun"); //[Beta] Desactivado afiltro por no existir aun //GUI.enabled = false; //togglesFiltros[1] = GUI.Toggle (new Rect (cuantoW * 2, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[1], new GUIContent ("", "Influencia Energetica"), "BotonFiltroRecursosRadioEnergia"); //GUI.enabled = true; //[Beta] -------------------------------------- togglesFiltros[1] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 6, cuantoW * 2, cuantoH * 2), togglesFiltros[1], new GUIContent ("", "Muestra los minerales raros"), "BotonFiltroRecursosMineralRaro"); //[Beta] Desactivado afiltro por no existir aun //GUI.enabled = false; //togglesFiltros[3] = GUI.Toggle (new Rect (cuantoW * 7, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[3], new GUIContent ("", "Terreno de las Granjas"), "BotonFiltroRecursosRadioGranja"); //GUI.enabled = true; //[Beta] -------------------------------------- GUI.EndGroup (); if (GUI.Button (new Rect (79 * cuantoW, posicionBloqueH * cuantoH, cuantoW, cuantoH), "", "BotonCerrar")) { tipoMenuDerecho = tMenuDerecho.ninguno; } break; case tMenuDerecho.filtroVegetales: switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 12.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 15; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 20; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 20 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 20 * cuantoH), "", "BloqueDerechoFiltroVegetales"); togglesFiltros[4] = GUI.Toggle (new Rect (cuantoW * 3, cuantoH * 4, cuantoW * 2, cuantoH * 2), togglesFiltros[4], new GUIContent ("", "Resaltar las Setas"), "BotonInsertarSeta"); togglesFiltros[5] = GUI.Toggle (new Rect (cuantoW * 3, cuantoH * 7, cuantoW * 2, cuantoH * 2), togglesFiltros[5], new GUIContent ("", "Resaltar las Ca\u00f1as"), "BotonInsertarCana"); togglesFiltros[6] = GUI.Toggle (new Rect (cuantoW * 3, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[6], new GUIContent ("", "Resaltar los Estromatolitos"), "BotonInsertarEstromatolito"); togglesFiltros[7] = GUI.Toggle (new Rect (cuantoW * 3, cuantoH * 13, cuantoW * 2, cuantoH * 2), togglesFiltros[7], new GUIContent ("", "Resaltar las Palmeras"), "BotonInsertarPalmera"); togglesFiltros[8] = GUI.Toggle (new Rect (cuantoW * 3, cuantoH * 16, cuantoW * 2, cuantoH * 2), togglesFiltros[8], new GUIContent ("", "Resaltar los Cipreses"), "BotonInsertarCipres"); togglesFiltros[9] = GUI.Toggle (new Rect (cuantoW * 6, cuantoH * 4, cuantoW * 2, cuantoH * 2), togglesFiltros[9], new GUIContent ("", "Resaltar las Flores"), "BotonInsertarFlor"); togglesFiltros[10] = GUI.Toggle (new Rect (cuantoW * 6, cuantoH * 7, cuantoW * 2, cuantoH * 2), togglesFiltros[10], new GUIContent ("", "Resaltar los Arbustos"), "BotonInsertarArbusto"); togglesFiltros[11] = GUI.Toggle (new Rect (cuantoW * 6, cuantoH * 10, cuantoW * 2, cuantoH * 2), togglesFiltros[11], new GUIContent ("", "Resaltar los Cactus"), "BotonInsertarCactus"); togglesFiltros[12] = GUI.Toggle (new Rect (cuantoW * 6, cuantoH * 13, cuantoW * 2, cuantoH * 2), togglesFiltros[12], new GUIContent ("", "Resaltar los Pinos"), "BotonInsertarPino"); togglesFiltros[13] = GUI.Toggle (new Rect (cuantoW * 6, cuantoH * 16, cuantoW * 2, cuantoH * 2), togglesFiltros[13], new GUIContent ("", "Resaltar los Pinos altos"), "BotonInsertarPinoAlto"); GUI.EndGroup (); //TODO Botones del filtro de vegetales if (GUI.Button (new Rect (79 * cuantoW, posicionBloqueH * cuantoH, cuantoW, cuantoH), "", "BotonCerrar")) { tipoMenuDerecho = tMenuDerecho.ninguno; } break; case tMenuDerecho.insercion: if (elementoInsercionDerecho == InterfazPrincipal.telementoInsercion.ninguno) { break; } switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 8.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 11; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 16; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 28 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoInsercion"); GUI.Label (new Rect (cuantoW, cuantoH, 9 * cuantoW, cuantoH), infoSeleccion[0], "LabelReducido"); //Este texto es el nombre imagenInsercionBloqueDerecho(); //Habitabilidad -- string habitabilidad; habitabilidad = (habitabilidadSeleccion[6] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[6] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 0.95f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[6].ToString ("N1"), "Costa"), habitabilidad); habitabilidad = (habitabilidadSeleccion[1] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[1] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 2.35f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[1].ToString ("N1"), "LLanura"), habitabilidad); habitabilidad = (habitabilidadSeleccion[2] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[2] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 3.66f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[2].ToString ("N1"), "Colina"), habitabilidad); habitabilidad = (habitabilidadSeleccion[0] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[0] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 4.96f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[0].ToString ("N1"), "Monta\u00f1a"), habitabilidad); habitabilidad = (habitabilidadSeleccion[4] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[4] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 6.26f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[4].ToString ("N1"), "Volcanico"), habitabilidad); habitabilidad = (habitabilidadSeleccion[7] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[7] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 7.59f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[7].ToString ("N1"), "Tundra"), habitabilidad); habitabilidad = (habitabilidadSeleccion[3] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[3] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[3].ToString ("N1"), "Desierto"), habitabilidad); /*GUI.Label (new Rect (cuantoW * 0.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[6].ToString ("N1"), "Costa"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 2.3f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[1].ToString ("N1"), "LLanura"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 3.6f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[2].ToString ("N1"), "Colina"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 4.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[0].ToString ("N1"), "Monta\u00f1a"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 6.2f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[4].ToString ("N1"), "Volcanico"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 7.5f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[7].ToString ("N1"), "Tundra"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 8.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[3].ToString ("N1"), "Desierto"), "LabelHabitabilidad");*/ //Habitabilidad -- GUI.Label (new Rect (cuantoW * 1, cuantoH * 13, 9 * cuantoW, 1 * cuantoH), "DESCRIPCION:", "LabelDescripcionTitulo"); //Titulo de la descripcion GUI.Label (new Rect (cuantoW * 1, cuantoH * 14, 9 * cuantoW, 4 * cuantoH), infoSeleccion[1], "LabelDescripcionContenido"); //Este texto es la descripcion GUI.Label(new Rect( cuantoW * 2, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[2], "LabelHabitabilidad"); //Coste energia GUI.Label(new Rect( cuantoW * 7, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[3], "LabelHabitabilidad"); //Coste comp bas GUI.Label(new Rect( cuantoW * 2, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[4], "LabelHabitabilidad"); //Coste comp adv GUI.Label(new Rect( cuantoW * 7, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[5], "LabelHabitabilidad"); //Coste mat bio if (tipoSeleccion >= 20) { //Si es un edificio... GUI.Label(new Rect(cuantoW * 1, cuantoH * 19, cuantoW * 9, cuantoH * 2), "", "InsercionEdificiosExtraProduccion"); GUI.Label(new Rect(cuantoW * 1.6f, cuantoH * 20, cuantoW * 1, cuantoH * 1), infoSeleccion[6], "LabelHabitabilidad"); GUI.Label(new Rect(cuantoW * 4, cuantoH * 20, cuantoW * 1, cuantoH * 1), infoSeleccion[7], "LabelHabitabilidad"); GUI.Label(new Rect(cuantoW * 6.7f, cuantoH * 20, cuantoW * 1, cuantoH * 1), infoSeleccion[8], "LabelHabitabilidad"); GUI.Label(new Rect(cuantoW * 9, cuantoH * 20, cuantoW * 1, cuantoH * 1), infoSeleccion[9], "LabelHabitabilidad"); } GUI.EndGroup (); //TODO Botones del filtro de vegetales if (GUI.Button (new Rect (79 * cuantoW, posicionBloqueH * cuantoH, cuantoW, cuantoH), "", "BotonCerrar")) { tipoMenuDerecho = tMenuDerecho.ninguno; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.ninguno; } break; case tMenuDerecho.seleccion: switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 8.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 11; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 16; //sobre 60 break; default: break; } if (infoSeleccion.Count == 0) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.ninguno; break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 28 * cuantoH)); if (tipoSeleccion < 20) { //Animales y plantas GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoSeleccion"); //Habitabilidad -- habitabilidad = (habitabilidadSeleccion[6] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[6] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 0.95f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[6].ToString ("N1"), "Costa"), habitabilidad); habitabilidad = (habitabilidadSeleccion[1] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[1] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 2.35f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[1].ToString ("N1"), "LLanura"), habitabilidad); habitabilidad = (habitabilidadSeleccion[2] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[2] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 3.66f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[2].ToString ("N1"), "Colina"), habitabilidad); habitabilidad = (habitabilidadSeleccion[0] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[0] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 4.96f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[0].ToString ("N1"), "Monta\u00f1a"), habitabilidad); habitabilidad = (habitabilidadSeleccion[4] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[4] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 6.26f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[4].ToString ("N1"), "Volcanico"), habitabilidad); habitabilidad = (habitabilidadSeleccion[7] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[7] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 7.59f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[7].ToString ("N1"), "Tundra"), habitabilidad); habitabilidad = (habitabilidadSeleccion[3] >= 0.0f)? "ImagenHabitable":"ImagenPocoHabitable"; habitabilidad = (habitabilidadSeleccion[3] == -1.0f)? "ImagenInhabitable":habitabilidad; GUI.Box (new Rect (cuantoW * 9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[3].ToString ("N1"), "Desierto"), habitabilidad); /*GUI.Label (new Rect (cuantoW * 0.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[6].ToString ("N1"), "Costa"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 2.3f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[1].ToString ("N1"), "LLanura"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 3.6f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[2].ToString ("N1"), "Colina"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 4.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[0].ToString ("N1"), "Monta\u00f1a"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 6.2f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[4].ToString ("N1"), "Volcanico"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 7.5f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[7].ToString ("N1"), "Tundra"), "LabelHabitabilidad"); GUI.Label (new Rect (cuantoW * 8.9f, 11 * cuantoH, 1 * cuantoW, 1 * cuantoH), new GUIContent (habitabilidadSeleccion[3].ToString ("N1"), "Desierto"), "LabelHabitabilidad");*/ //Habitabilidad -- GUI.Label (new Rect (cuantoW * 1, cuantoH * 13, 9 * cuantoW, 1 * cuantoH), "DESCRIPCION:", "LabelDescripcionTitulo"); //Titulo de la descripcion GUI.Label (new Rect (cuantoW * 1, cuantoH * 14, 9 * cuantoW, 4 * cuantoH), infoSeleccion[1], "LabelDescripcionContenido"); //Este texto es la descripcion } else { //Edificios if(edificioSeleccionado.tipo != principal.vida.tiposEdificios[1] && edificioSeleccionado.tipo != principal.vida.tiposEdificios[4]) GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoSelEdificio"); else GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoSelEdificioSinEficiencia"); GUI.Label (new Rect (cuantoW * 1, cuantoH * 8, 9 * cuantoW, 1 * cuantoH), "DESCRIPCION:", "LabelDescripcionTitulo"); //Titulo de la descripcion GUI.Label (new Rect (cuantoW * 1, cuantoH * 9, 9 * cuantoW, 4 * cuantoH), infoSeleccion[1], "LabelDescripcionContenido"); //Este texto es la descripcion } GUI.Label (new Rect (cuantoW, cuantoH, 9 * cuantoW, cuantoH), infoSeleccion[0], "LabelReducido"); //Este texto es el nombre imagenSeleccionBloqueDerecho(); if (tipoSeleccion < 10) { //Plantas GUI.Label (new Rect (cuantoW * 1, cuantoH * 19, 9 * cuantoW, 1 * cuantoH), "NUMERO DE PLANTAS:", "LabelDescripcionTitulo"); GUI.Label (new Rect (cuantoW * 2, cuantoH * 20, 8 * cuantoW, 4 * cuantoH), vegetalSeleccionado.numVegetales.ToString (), "LabelDescripcionContenido"); } else if (tipoSeleccion < 20) { //Animales //2 carnivoro-herbivoro GUI.Label (new Rect (cuantoW * 1, cuantoH * 19, 9 * cuantoW, 1 * cuantoH), "ALIMENTACION:", "LabelDescripcionTitulo"); if (animalSeleccionado.especie.tipo == tipoAlimentacionAnimal.carnivoro) { GUI.Label (new Rect (cuantoW * 2, cuantoH * 20, 8 * cuantoW, 4 * cuantoH), "Carnivoro", "LabelDescripcionContenido"); } else { GUI.Label (new Rect (cuantoW * 2, cuantoH * 20, 8 * cuantoW, 4 * cuantoH), "Herbivoro", "LabelDescripcionContenido"); } //----------------------- //3 comida dentro (reserva) GUI.Label (new Rect (cuantoW * 1, cuantoH * 21, 9 * cuantoW, 1 * cuantoH), "HAMBRE:", "LabelDescripcionTitulo"); if (animalSeleccionado.reserva < (animalSeleccionado.especie.reservaMaxima / 4)) { //Menor al 25% GUI.Label (new Rect (cuantoW * 2, cuantoH * 22, 8 * cuantoW, 4 * cuantoH), "Hambiento!", "LabelDescripcionContenido"); } else if (animalSeleccionado.reserva < (animalSeleccionado.especie.reservaMaxima / 2)) { //Menor al 50% GUI.Label (new Rect (cuantoW * 2, cuantoH * 22, 8 * cuantoW, 4 * cuantoH), "Bastante", "LabelDescripcionContenido"); } else if (animalSeleccionado.reserva < (animalSeleccionado.especie.reservaMaxima / 4) * 3) { //Menor al 75% GUI.Label (new Rect (cuantoW * 2, cuantoH * 22, 8 * cuantoW, 4 * cuantoH), "Poca", "LabelDescripcionContenido"); } else GUI.Label (new Rect (cuantoW * 2, cuantoH * 22, 8 * cuantoW, 4 * cuantoH), "LLeno", "LabelDescripcionContenido"); //----------------------- //4 estado GUI.Label (new Rect (cuantoW * 1, cuantoH * 23, 9 * cuantoW, 1 * cuantoH), "ESTADO:", "LabelDescripcionTitulo"); switch (animalSeleccionado.estado) { case tipoEstadoAnimal.buscarAlimento: GUI.Label (new Rect (cuantoW * 2, cuantoH * 24, 8 * cuantoW, 4 * cuantoH), "Buscando comida\n", "LabelDescripcionContenido"); break; case tipoEstadoAnimal.comer: GUI.Label (new Rect (cuantoW * 2, cuantoH * 24, 8 * cuantoW, 4 * cuantoH), "Comiendo\n", "LabelDescripcionContenido"); break; case tipoEstadoAnimal.descansar: GUI.Label (new Rect (cuantoW * 2, cuantoH * 24, 8 * cuantoW, 4 * cuantoH), "Descansando\n", "LabelDescripcionContenido"); break; case tipoEstadoAnimal.morir: GUI.Label (new Rect (cuantoW * 2, cuantoH * 24, 8 * cuantoW, 4 * cuantoH), "Muriendo\n", "LabelDescripcionContenido"); break; case tipoEstadoAnimal.nacer: GUI.Label (new Rect (cuantoW * 2, cuantoH * 24, 8 * cuantoW, 4 * cuantoH), "Naciendo\n", "LabelDescripcionContenido"); break; } //------------------------ } else { //Edificios sliderEficiencia = edificioSeleccionado.eficiencia; //GUI.Label(new Rect(cuantoW * 1, cuantoH * 18, cuantoW * 9, cuantoH * 1),edificioSeleccionado.numMetales.ToString()); if(tipoSeleccion != 21 && tipoSeleccion != 24) { sliderEficiencia = GUI.HorizontalSlider(new Rect(cuantoW * 1, cuantoH * 19, cuantoW * 9, cuantoH * 1), sliderEficiencia, 0.0f, 1.0f); float eficiencia = (float)((int)(sliderEficiencia * 100.0f) / 25) * 0.25f; if(edificioSeleccionado.eficiencia != eficiencia) { int radioAccion; List<Tupla<int,int,bool>> matrizRadioAccion; if(eficiencia < 0.25f) { radioAccion = 0; matrizRadioAccion = new List<Tupla<int, int, bool>>(); } else if(eficiencia < 0.5f) { radioAccion = 2; matrizRadioAccion = FuncTablero.calculaMatrizRadio2Circular(edificioSeleccionado.posX,edificioSeleccionado.posY); } else if(eficiencia < 0.75f) { radioAccion = 3; matrizRadioAccion = FuncTablero.calculaMatrizRadio3Circular(edificioSeleccionado.posX,edificioSeleccionado.posY); } else if(eficiencia < 1.0f) { radioAccion = 4; matrizRadioAccion = FuncTablero.calculaMatrizRadio4Circular(edificioSeleccionado.posX,edificioSeleccionado.posY); } else { radioAccion = 5; matrizRadioAccion = FuncTablero.calculaMatrizRadio5Circular(edificioSeleccionado.posX,edificioSeleccionado.posY); } int numMetales = 0; if(edificioSeleccionado.tipo.metalesAUsar == T_elementos.comunes) numMetales = principal.vida.calculaMetalesComunes(matrizRadioAccion); else if(edificioSeleccionado.tipo.metalesAUsar == T_elementos.raros) numMetales = principal.vida.calculaMetalesRaros(matrizRadioAccion); edificioSeleccionado.modificaEficiencia(eficiencia,numMetales,matrizRadioAccion,radioAccion); } } GUI.Label(new Rect( cuantoW * 2, cuantoH * 23, cuantoW * 3, cuantoH * 1), "" + (edificioSeleccionado.energiaProducidaPorTurno - edificioSeleccionado.energiaConsumidaPorTurno), "LabelHabitabilidad"); //Coste energia GUI.Label(new Rect( cuantoW * 7, cuantoH * 23, cuantoW * 3, cuantoH * 1), "" + (edificioSeleccionado.compBasProducidosPorTurno - edificioSeleccionado.compBasConsumidosPorTurno), "LabelHabitabilidad"); //Coste comp bas GUI.Label(new Rect( cuantoW * 2, cuantoH * 25, cuantoW * 3, cuantoH * 1), "" + (edificioSeleccionado.compAvzProducidosPorTurno - edificioSeleccionado.compAvzConsumidosPorTurno), "LabelHabitabilidad"); //Coste comp adv GUI.Label(new Rect( cuantoW * 7, cuantoH * 25, cuantoW * 3, cuantoH * 1), "" + (edificioSeleccionado.matBioProducidoPorTurno - edificioSeleccionado.matBioConsumidoPorTurno), "LabelHabitabilidad"); //Coste mat bio } GUI.EndGroup (); //TODO Botones del filtro de vegetales if (GUI.Button (new Rect (79 * cuantoW, posicionBloqueH * cuantoH, cuantoW, cuantoH), "", "BotonCerrar")) { tipoMenuDerecho = tMenuDerecho.ninguno; } break; case tMenuDerecho.mejoras: if (mejoraHover == -1) { break; } switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 8.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 11; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 16; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 28 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoMejoras"); GUI.Label (new Rect (cuantoW, cuantoH * 1, 9 * cuantoW, cuantoH), infoSeleccion[0], "LabelReducido"); //Este texto es el nombre imagenMejorasBloqueDerecho(); GUI.Label (new Rect (cuantoW * 1, cuantoH * 8, 9 * cuantoW, 1 * cuantoH), "DESCRIPCION:", "LabelDescripcionTitulo"); //Titulo de la descripcion GUI.Label (new Rect (cuantoW * 1, cuantoH * 9, 9 * cuantoW, 8 * cuantoH), infoSeleccion[1], "LabelDescripcionContenido"); //Este texto es la descripcion //Costes GUI.Label(new Rect( cuantoW * 2, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[2], "LabelHabitabilidad"); //Coste energia GUI.Label(new Rect( cuantoW * 7, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[3], "LabelHabitabilidad"); //Coste comp bas GUI.Label(new Rect( cuantoW * 2, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[4], "LabelHabitabilidad"); //Coste comp adv GUI.Label(new Rect( cuantoW * 7, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[5], "LabelHabitabilidad"); //Coste mat bio GUI.EndGroup(); break; case tMenuDerecho.habilidades: if (habilidadHover == -1) { break; } switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloqueH = 8.5f; //sobre 45 break; case taspectRatio.aspectRatio16_10: posicionBloqueH = 11; //sobre 50 break; case taspectRatio.aspectRatio4_3: posicionBloqueH = 16; //sobre 60 break; default: break; } GUI.BeginGroup (new Rect (69 * cuantoW, posicionBloqueH * cuantoH, 11 * cuantoW, 28 * cuantoH)); GUI.Box (new Rect (0, 0, 11 * cuantoW, 28 * cuantoH), "", "BloqueDerechoHabilidades"); GUI.Label (new Rect (cuantoW, cuantoH * 1, 9 * cuantoW, cuantoH), infoSeleccion[0], "LabelReducido"); //Este texto es el nombre imagenHabilidadesBloqueDerecho(); GUI.Label (new Rect (cuantoW * 1, cuantoH * 8, 9 * cuantoW, 1 * cuantoH), "DESCRIPCION:", "LabelDescripcionTitulo"); //Titulo de la descripcion GUI.Label (new Rect (cuantoW * 1, cuantoH * 9, 9 * cuantoW, 8 * cuantoH), infoSeleccion[1], "LabelDescripcionContenido"); //Este texto es la descripcion //Costes GUI.Label(new Rect( cuantoW * 2, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[2], "LabelHabitabilidad"); //Coste energia GUI.Label(new Rect( cuantoW * 7, cuantoH * 23, cuantoW * 3, cuantoH * 1), infoSeleccion[3], "LabelHabitabilidad"); //Coste comp bas GUI.Label(new Rect( cuantoW * 2, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[4], "LabelHabitabilidad"); //Coste comp adv GUI.Label(new Rect( cuantoW * 7, cuantoH * 25, cuantoW * 3, cuantoH * 1), infoSeleccion[5], "LabelHabitabilidad"); //Coste mat bio GUI.EndGroup(); break; default: break; } //Fin switch if (GUI.changed || filtrosModificados) { //TODO [Maf] Faltan los botones para desactivar carnivoros y herbivoros del tiron, que no los he encontrado. //Solo que se desactiven los ya puestos o un toggle ke se activen en rojo los carnivoros y en verde los herbivoros y sino se desactiven? Lo hablamos. /*En todo caso seria algo asi desactivarlos * for (int i = 0; i< materiales.herbivoros.Count; i++){ * materiales.herbivoros[i].SetFloat("_FiltroOn",0.0f); * materiales.herviboros[i].SetColor("_Tinte",Color.white); * } * y lo mismo con carnivoros[i]. */ for (int i = 0; i < togglesFiltros.Length; i++) { if (togglesFiltros[i] != togglesFiltrosOld[i]) { switch (i) { case 0: //Boton minerales comunes if (togglesFiltros[i]) materiales.recursos.SetFloat ("_ComunesOn", 1.0f); else materiales.recursos.SetFloat ("_ComunesOn", 0.0f); break; case 1: //Boton minerales raros if (togglesFiltros[i]) materiales.recursos.SetFloat ("_RarosOn", 1.0f); else materiales.recursos.SetFloat ("_RarosOn", 0.0f); break; /*case 1: //Boton radio Edificios if (togglesFiltros[i]) materiales.recursos.SetFloat ("_EdificiosOn", 1.0f); else materiales.recursos.SetFloat ("_EdificiosOn", 0.0f); break;*/ case 2: //Boton minerales raros if (togglesFiltros[i]) materiales.recursos.SetFloat ("_RarosOn", 1.0f); else materiales.recursos.SetFloat ("_RarosOn", 0.0f); break; /*case 3: //boton radio Granjas if (togglesFiltros[i]) materiales.recursos.SetFloat ("_GranjasOn", 1.0f); else materiales.recursos.SetFloat ("_GranjasOn", 0.0f); break;*/ case 4: //boton plantas 1 if (togglesFiltros[i]) { materiales.plantas[0].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[0].SetColor ("_Tinte", new Color (0.7f, 0.7f, 0.5f)); } else { materiales.plantas[0].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[0].SetColor ("_Tinte", Color.white); } break; case 5: //boton plantas 3 if (togglesFiltros[i]) { materiales.plantas[2].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[2].SetColor ("_Tinte", new Color (1.0f, 0.5f, 0.0f)); } else { materiales.plantas[2].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[2].SetColor ("_Tinte", Color.white); } break; case 6: //boton plantas 5 if (togglesFiltros[i]) { materiales.plantas[4].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[4].SetColor ("_Tinte", Color.red); } else { materiales.plantas[4].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[4].SetColor ("_Tinte", Color.white); } break; case 7: //boton plantas 7 if (togglesFiltros[i]) { materiales.plantas[6].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[6].SetColor ("_Tinte", new Color (0.0f, 0.7f, 0.7f)); } else { materiales.plantas[6].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[6].SetColor ("_Tinte", Color.white); } break; case 8: //boton plantas 9 if (togglesFiltros[i]) { materiales.plantas[8].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[8].SetColor ("_Tinte", new Color (0.5f, 0.0f, 1.0f)); } else { materiales.plantas[8].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[8].SetColor ("_Tinte", Color.white); } break; case 9: //boton plantas 2 if (togglesFiltros[i]) { materiales.plantas[1].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[1].SetColor ("_Tinte", new Color (1.0f, 1.0f, 0.0f)); } else { materiales.plantas[1].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[1].SetColor ("_Tinte", Color.white); } break; case 10: //boton plantas 4 if (togglesFiltros[i]) { materiales.plantas[3].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[3].SetColor ("_Tinte", new Color (1.0f, 0.3f, 0.0f)); } else { materiales.plantas[3].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[3].SetColor ("_Tinte", Color.white); } break; case 11: //boton plantas 6 if (togglesFiltros[i]) { materiales.plantas[5].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[5].SetColor ("_Tinte", Color.green); } else { materiales.plantas[5].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[5].SetColor ("_Tinte", Color.white); } break; case 12: //boton plantas 8 if (togglesFiltros[i]) { materiales.plantas[7].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[7].SetColor ("_Tinte", new Color (0.0f, 0.5f, 1.0f)); } else { materiales.plantas[7].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[7].SetColor ("_Tinte", Color.white); } break; case 13: //boton plantas 10 if (togglesFiltros[i]) { materiales.plantas[9].SetFloat ("_FiltroOn", 1.0f); materiales.plantas[9].SetColor ("_Tinte", new Color (1.0f, 0.5f, 1.0f)); } else { materiales.plantas[9].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[9].SetColor ("_Tinte", Color.white); } break; case 14: //boton herbivoro 1 if (togglesFiltros[i]) { materiales.herbivoros[0].SetFloat ("_FiltroOn", 1.0f); materiales.herbivoros[0].SetColor ("_Tinte", Color.green); } else { materiales.herbivoros[0].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[0].SetColor ("_Tinte", Color.white); } break; case 15: //boton herbivoro 2 if (togglesFiltros[i]) { materiales.herbivoros[1].SetFloat ("_FiltroOn", 1.0f); materiales.herbivoros[1].SetColor ("_Tinte", new Color (0.0f, 0.7f, 0.7f)); } else { materiales.herbivoros[1].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[1].SetColor ("_Tinte", Color.white); } break; case 16: //boton herbivoro 3 if (togglesFiltros[i]) { materiales.herbivoros[2].SetFloat ("_FiltroOn", 1.0f); materiales.herbivoros[2].SetColor ("_Tinte", new Color (0.0f, 0.5f, 1.0f)); } else { materiales.herbivoros[2].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[2].SetColor ("_Tinte", Color.white); } break; case 17: //boton herbivoro 4 if (togglesFiltros[i]) { materiales.herbivoros[3].SetFloat ("_FiltroOn", 1.0f); materiales.herbivoros[3].SetColor ("_Tinte", new Color (0.5f, 0.0f, 1.0f)); } else { materiales.herbivoros[3].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[3].SetColor ("_Tinte", Color.white); } break; case 18: //boton herbivoro 5 if (togglesFiltros[i]) { materiales.herbivoros[4].SetFloat ("_FiltroOn", 1.0f); materiales.herbivoros[4].SetColor ("_Tinte", new Color (1.0f, 0.5f, 1.0f)); } else { materiales.herbivoros[4].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[4].SetColor ("_Tinte", Color.white); } break; case 19: //boton carnivoro 1 if (togglesFiltros[i]) { materiales.carnivoros[0].SetFloat ("_FiltroOn", 1.0f); materiales.carnivoros[0].SetColor ("_Tinte", new Color (0.7f, 0.7f, 0.5f)); } else { materiales.carnivoros[0].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[0].SetColor ("_Tinte", Color.white); } break; case 20: //boton carnivoro 2 if (togglesFiltros[i]) { materiales.carnivoros[1].SetFloat ("_FiltroOn", 1.0f); materiales.carnivoros[1].SetColor ("_Tinte", new Color (1.0f, 1.0f, 0.0f)); } else { materiales.carnivoros[1].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[1].SetColor ("_Tinte", Color.white); } break; case 21: //boton carnivoro 3 if (togglesFiltros[i]) { materiales.carnivoros[2].SetFloat ("_FiltroOn", 1.0f); materiales.carnivoros[2].SetColor ("_Tinte", new Color (1.0f, 0.5f, 0.0f)); } else { materiales.carnivoros[2].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[2].SetColor ("_Tinte", Color.white); } break; case 22: //boton carnivoro 4 if (togglesFiltros[i]) { materiales.carnivoros[3].SetFloat ("_FiltroOn", 1.0f); materiales.carnivoros[3].SetColor ("_Tinte", new Color (1.0f, 0.3f, 0.0f)); } else { materiales.carnivoros[3].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[3].SetColor ("_Tinte", Color.white); } break; case 23: //boton carnivoro 5 if (togglesFiltros[i]) { materiales.carnivoros[4].SetFloat ("_FiltroOn", 1.0f); materiales.carnivoros[4].SetColor ("_Tinte", Color.red); } else { materiales.carnivoros[4].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[4].SetColor ("_Tinte", Color.white); } break; } togglesFiltrosOld[i] = togglesFiltros[i]; } } } }
private void insertarElemento() { if (accion == taccion.insertar) { if (Time.realtimeSinceStartup > tiempoUltimoModeloInsercion + tiempoModeloInsercion) { tiempoUltimoModeloInsercion = Time.realtimeSinceStartup; int posX = 0; int posY = 0; RaycastHit hit; int tipo = (int)elementoInsercion - 1; if (principal.raycastRoca (Input.mousePosition, ref posX, ref posY, out hit)) { //Vector3 coordsVert = principal.vida.tablero[posY, posX].coordsVert; //Vector3 coordsVert = new Vector3(principal.vida.tablero[posY, posX].coordsVert.x,principal.vida.tablero[posY, posX].coordsVert.y,hit.normal.z); //Mover la malla //modeloInsercion.transform.position = coordsVert; modeloInsercion.transform.position = hit.point; Vector3 normal = modeloInsercion.transform.position - modeloInsercion.transform.parent.position; //modeloInsercion.transform.position = principal.vida.objetoRoca.transform.TransformPoint (modeloInsercion.transform.position); modeloInsercion.transform.rotation = Quaternion.LookRotation (normal); modeloInsercion.GetComponentInChildren<Renderer>().material.SetFloat ("_FiltroOn", 1.0f); modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.red); forzarTooltip = false; //Edificio if (tipo >= 0 && tipo < 5) { TipoEdificio tedif = principal.vida.tiposEdificios[tipo]; if (principal.recursosSuficientes (tedif.energiaConsumidaAlCrear, tedif.compBasConsumidosAlCrear, tedif.compAvzConsumidosAlCrear, tedif.matBioConsumidoAlCrear)) { if (principal.vida.compruebaAnadeEdificio (tedif, posY, posX)) modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.green); else { forzarTooltip = true; mensajeForzarTooltip = "Habitat incompatible o ya ocupado"; } } else { forzarTooltip = true; mensajeForzarTooltip = "No hay recursos suficientes"; } //Vegetal } else if (tipo >= 5 && tipo < 15) { tipo -= 5; EspecieVegetal especie = (EspecieVegetal)principal.vida.especies[tipo]; if (principal.vida.compruebaAnadeVegetal (especie, especie.habitabilidadInicial, 0.0f, posY, posX)) modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.green); else { forzarTooltip = true; mensajeForzarTooltip = "Habitat incompatible o ya ocupado"; } //Animal (herbivoro o carnivoro) } else if (tipo >= 15 && tipo < 25) { tipo -= 5; EspecieAnimal especie = (EspecieAnimal)principal.vida.especies[tipo]; if (principal.vida.compruebaAnadeAnimal (especie, posY, posX)) modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.green); else { forzarTooltip = true; mensajeForzarTooltip = "Habitat incompatible o ya ocupado"; } } //Probamos inserción if (Input.GetMouseButton (0)) { tipo = (int)elementoInsercion - 1; //Edificio if (tipo >= 0 && tipo < 5) { TipoEdificio tedif = principal.vida.tiposEdificios[tipo]; if (principal.recursosSuficientes (tedif.energiaConsumidaAlCrear, tedif.compBasConsumidosAlCrear, tedif.compAvzConsumidosAlCrear, tedif.matBioConsumidoAlCrear)) { float eficiencia = 1.0f; int radioAccion; List<Tupla<int,int,bool>> matrizRadioAccion; if(eficiencia < 0.25f) { radioAccion = 0; matrizRadioAccion = new List<Tupla<int, int, bool>>(); } else if(eficiencia < 0.5f) { radioAccion = 2; matrizRadioAccion = FuncTablero.calculaMatrizRadio2Circular(posY,posX); } else if(eficiencia < 0.75f) { radioAccion = 3; matrizRadioAccion = FuncTablero.calculaMatrizRadio3Circular(posY,posX); } else if(eficiencia < 1.0f) { radioAccion = 4; matrizRadioAccion = FuncTablero.calculaMatrizRadio4Circular(posY,posX); } else { radioAccion = 5; matrizRadioAccion = FuncTablero.calculaMatrizRadio5Circular(posY,posX); } int numMetales = 0; if(tedif.metalesAUsar == T_elementos.comunes) numMetales = principal.vida.calculaMetalesComunes(matrizRadioAccion); else if(tedif.metalesAUsar == T_elementos.raros) numMetales = principal.vida.calculaMetalesRaros(matrizRadioAccion); if (principal.vida.anadeEdificio (tedif, posY, posX, eficiencia,numMetales,matrizRadioAccion,radioAccion, hit.point)) { principal.consumeRecursos (tedif.energiaConsumidaAlCrear, tedif.compBasConsumidosAlCrear, tedif.compAvzConsumidosAlCrear, tedif.matBioConsumidoAlCrear); principal.vida.tablero[posY, posX].edificio.modelo.GetComponentInChildren<Animation>().Play(); if (elementoInsercion == telementoInsercion.centralEnergia && etapaJuego == tEtapaJuego.inicio) etapaJuego = InterfazPrincipal.tEtapaJuego.centralConstruida; if (elementoInsercion == telementoInsercion.fabricaCompBas && etapaJuego == tEtapaJuego.centralConstruida) etapaJuego = InterfazPrincipal.tEtapaJuego.fabCompBasConstruida; if (elementoInsercion == telementoInsercion.granja && etapaJuego == tEtapaJuego.mejoraBiologicoComprada) etapaJuego = InterfazPrincipal.tEtapaJuego.granjaConstruida; if (elementoInsercion == telementoInsercion.fabricaCompAdv && etapaJuego == tEtapaJuego.mejoraAvanzadosComprada) etapaJuego = InterfazPrincipal.tEtapaJuego.fabCompAdvComprada; } else { GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeErrorPosicion; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); //Sonidos de error son el 1 y 2 } } else { GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeNoRecursos; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); //Sonidos de error son el 1 y 2 } elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; //principal.objetoRoca.renderer.sharedMaterials[3].SetFloat("_FiltroOn", 0); //Vegetal } else if (tipo >= 5 && tipo < 15) { tipo -= 5; EspecieVegetal especie = (EspecieVegetal)principal.vida.especies[tipo]; TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(especie)); if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { if (principal.vida.anadeVegetal (especie, especie.habitabilidadInicial, 0.0f, posY, posX, hit.point)) { principal.consumeRecursos(costes[0], costes[1], costes[2], costes[3]); elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; } else { //No se puede ahi GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeErrorPosicion; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); } } else { //Sin recursos GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeNoRecursos; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); } //Animal (herbivoro o carnivoro) } else if (tipo >= 15 && tipo < 25) { tipo -= 5; EspecieAnimal especie = (EspecieAnimal)principal.vida.especies[tipo]; TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(especie)); if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { if (principal.vida.anadeAnimal (especie, posY, posX,hit.point)) { principal.consumeRecursos(costes[0], costes[1], costes[2], costes[3]); elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; } else { GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeErrorPosicion; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); //Sonidos de error son el 1 y 2 } } else { //No hay recursos suficientes GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeNoRecursos; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); } } Destroy (modeloInsercion); //Desactivamos inserción } else if (Input.GetMouseButton (1)) { elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; Destroy (modeloInsercion); } } } } }
private void insertarPortal() { if (accion == taccion.insertarPortal && etapaJuego < tEtapaJuego.portalConstruido) { int posX = 0; int posY = 0; RaycastHit hit; if (principal.raycastRoca (Input.mousePosition, ref posX, ref posY, out hit)) { //Mover la malla modeloInsercion.transform.position = hit.point; Vector3 normal = modeloInsercion.transform.position - modeloInsercion.transform.parent.position; modeloInsercion.transform.rotation = Quaternion.LookRotation (normal); modeloInsercion.GetComponentInChildren<Renderer>().material.SetFloat ("_FiltroOn", 1.0f); modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.red); List<int> costes = mejoras.costeHab8; Casilla temp = principal.vida.tablero[posY, posX]; if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { if (temp.habitat == T_habitats.llanura && temp.edificio == null) modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.green); else { forzarTooltip = true; mensajeForzarTooltip = "Habitat incompatible o ya ocupado"; } } else { forzarTooltip = true; mensajeForzarTooltip = "No hay recursos suficientes"; } //Probamos inserción if (Input.GetMouseButton (0)) { if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { if (temp.habitat == T_habitats.llanura && temp.edificio == null) { principal.consumeRecursos (costes[0], costes[1], costes[2], costes[3]); modeloInsercion.GetComponentInChildren<Renderer>().material.SetColor ("_Tinte", Color.white); modeloInsercion.GetComponentInChildren<Renderer>().material.SetFloat ("_FiltroOn", 0.0f); modeloInsercion.GetComponentInChildren<Animation>().Play(); etapaJuego = InterfazPrincipal.tEtapaJuego.portalConstruido; } else { GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeErrorPosicion; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); Destroy (modeloInsercion); //Sonidos de error son el 1 y 2 } } else { GameObject mensaje = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().mensajeNoRecursos; Vector3 posicionMensaje = Vector3.Lerp(modeloInsercion.transform.position, Camera.main.transform.position, 0.15f); Instantiate(mensaje, posicionMensaje, Quaternion.LookRotation(Camera.main.transform.forward)); Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> (); efectos.playNumber (Random.Range (1, 3)); Destroy (modeloInsercion); //Sonidos de error son el 1 y 2 } elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; } else if (Input.GetMouseButton (1)) { elementoInsercion = telementoInsercion.ninguno; accion = taccion.ninguna; Destroy (modeloInsercion); } } } }
//Dibuja el bloque seleccion de la ventana que contiene los diferentes edificios, animales o vegetales seleccionables según que botón se haya pulsado en el bloque izquierdo private void bloqueSeleccion() { int posicionBloque = 0; int posicionBloqueMejoras = 0; switch (aspectRatio) { case taspectRatio.aspectRatio16_9: posicionBloque = 40; posicionBloqueMejoras = 37; break; case taspectRatio.aspectRatio16_10: posicionBloque = 45; posicionBloqueMejoras = 42; break; case taspectRatio.aspectRatio4_3: posicionBloque = 55; posicionBloqueMejoras = 52; break; default: break; } switch (accion) { case taccion.ninguna: case taccion.insertar: case taccion.mostrarInfoDetallada: case taccion.mostrarMenu: break; case taccion.seleccionarVegetal: Rect areaTemp = new Rect (cuantoW * 22, cuantoH * posicionBloque, cuantoW * 36, cuantoH * 4); GUILayout.BeginArea (areaTemp, new GUIContent (), "BloqueSeleccionVegetales"); elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.ninguno; GUILayout.BeginVertical (); GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW * 2.5f); if (GUILayout.Button (new GUIContent ("", "Seta"), "BotonInsertarSeta")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[0])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.seta; modeloInsercion = principal.vida.especiesVegetales[0].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[0].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.seta; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Flor"), "BotonInsertarFlor")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[1])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.flor; modeloInsercion = principal.vida.especiesVegetales[1].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[1].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.flor; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Caña"), "BotonInsertarCana")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[2])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.cana; modeloInsercion = principal.vida.especiesVegetales[2].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[2].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.cana; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Arbusto"), "BotonInsertarArbusto")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[3])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.arbusto; modeloInsercion = principal.vida.especiesVegetales[3].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[3].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.arbusto; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Estromatolito"), "BotonInsertarEstromatolito")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[4])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.estromatolito; modeloInsercion = principal.vida.especiesVegetales[4].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[4].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.estromatolito; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Cactus"), "BotonInsertarCactus")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[5])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.cactus; modeloInsercion = principal.vida.especiesVegetales[5].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[5].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.cactus; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Palmera"), "BotonInsertarPalmera")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[6])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.palmera; modeloInsercion = principal.vida.especiesVegetales[6].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[6].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.palmera; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Pino"), "BotonInsertarPino")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[7])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.pino; modeloInsercion = principal.vida.especiesVegetales[7].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[7].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.pino; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Ciprés"), "BotonInsertarCipres")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[8])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.cipres; modeloInsercion = principal.vida.especiesVegetales[8].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[8].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.cipres; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Pino Alto"), "BotonInsertarPinoAlto")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesVegetales[9])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.pinoAlto; modeloInsercion = principal.vida.especiesVegetales[9].modelos[UnityEngine.Random.Range (0, principal.vida.especiesVegetales[9].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.pinoAlto; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW * 2.5f); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.EndVertical (); GUILayout.EndArea (); break; case taccion.seleccionarAnimal: GUILayout.BeginArea (new Rect (cuantoW * 22, cuantoH * posicionBloque, cuantoW * 36, cuantoH * 4), new GUIContent (), "BloqueSeleccionAnimales"); GUILayout.BeginVertical (); elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.ninguno; GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW * 1.5f); if (GUILayout.Button (new GUIContent ("", "Insertar insectos herbivoros"), "BotonInsertarHerbivoro1")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[0])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.herbivoro1; modeloInsercion = principal.vida.especiesAnimales[0].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[0].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.herbivoro1; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar peque\u00f1os roedores"), "BotonInsertarHerbivoro2")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[1])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.herbivoro2; modeloInsercion = principal.vida.especiesAnimales[1].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[1].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.herbivoro2; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar grandes vacunos"), "BotonInsertarHerbivoro3")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[2])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.herbivoro3; modeloInsercion = principal.vida.especiesAnimales[2].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[2].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.herbivoro3; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar herbivoros de la sabana"), "BotonInsertarHerbivoro4")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[3])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.herbivoro4; modeloInsercion = principal.vida.especiesAnimales[3].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[3].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.herbivoro4; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar tortuga gigante"), "BotonInsertarHerbivoro5")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[4])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.herbivoro5; modeloInsercion = principal.vida.especiesAnimales[4].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[4].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.herbivoro5; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW * 3); if (GUILayout.Button (new GUIContent ("", "Insertar zorro"), "BotonInsertarCarnivoro1")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[5])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.carnivoro1; modeloInsercion = principal.vida.especiesAnimales[5].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[5].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.carnivoro1; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar lobo"), "BotonInsertarCarnivoro2")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[6])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.carnivoro2; modeloInsercion = principal.vida.especiesAnimales[6].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[6].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.carnivoro2; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar tigre"), "BotonInsertarCarnivoro3")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[7])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.carnivoro3; modeloInsercion = principal.vida.especiesAnimales[7].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[7].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.carnivoro3; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar oso"), "BotonInsertarCarnivoro4")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[8])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.carnivoro4; modeloInsercion = principal.vida.especiesAnimales[8].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[8].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.carnivoro4; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Insertar tiranosaurio"), "BotonInsertarCarnivoro5")) { TiposSeres tiposSeres = GameObject.FindGameObjectWithTag ("TiposSeres").GetComponent<TiposSeres> (); List<int> costes = tiposSeres.getCostes(tiposSeres.getNumeroSer(principal.vida.especiesAnimales[9])); if (!principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.carnivoro5; modeloInsercion = principal.vida.especiesAnimales[9].modelos[UnityEngine.Random.Range (0, principal.vida.especiesAnimales[9].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.carnivoro5; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW * 1.5f); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.EndVertical (); GUILayout.EndArea (); break; case taccion.seleccionarEdificio: GUILayout.BeginArea (new Rect (cuantoW * 32, cuantoH * posicionBloque, cuantoW * 16, cuantoH * 4), new GUIContent (), "BloqueSeleccionEdificios"); GUILayout.BeginVertical (); elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.ninguno; GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW); if (GUILayout.Button (new GUIContent ("", "Central de energía"), "BotonInsertarCenEn")) { TipoEdificio temp = principal.vida.tiposEdificios[1]; int eneTemp = temp.energiaConsumidaAlCrear; int compBasTemp = temp.compBasConsumidosAlCrear; int compAdvTemp = temp.compAvzConsumidosAlCrear; int matBioTemp = temp.matBioConsumidoAlCrear; if (!principal.recursosSuficientes(eneTemp, compBasTemp, compAdvTemp, matBioTemp)) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.centralEnergia; modeloInsercion = principal.vida.tiposEdificios[1].modelos[UnityEngine.Random.Range (0, principal.vida.tiposEdificios[1].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.centralEnergia; seleccionarObjetoInsercion (); } GUILayout.Space (cuantoW); string tooltip = ""; if (etapaJuego < tEtapaJuego.centralConstruida) { GUI.enabled = false; tooltip = "Debes construir primero una central de energia!"; } else tooltip = "Fábrica de componentes básicos"; if (GUILayout.Button (new GUIContent ("", tooltip), "BotonInsertarFabComBas")) { TipoEdificio temp = principal.vida.tiposEdificios[0]; int eneTemp = temp.energiaConsumidaAlCrear; int compBasTemp = temp.compBasConsumidosAlCrear; int compAdvTemp = temp.compAvzConsumidosAlCrear; int matBioTemp = temp.matBioConsumidoAlCrear; if (!principal.recursosSuficientes(eneTemp, compBasTemp, compAdvTemp, matBioTemp)) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.fabricaCompBas; modeloInsercion = principal.vida.tiposEdificios[0].modelos[UnityEngine.Random.Range (0, principal.vida.tiposEdificios[0].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.fabricaCompBas; seleccionarObjetoInsercion (); } GUI.enabled = true; GUILayout.Space (cuantoW); if (etapaJuego < tEtapaJuego.mejoraBiologicoComprada) { GUI.enabled = false; tooltip = "Debes investigar esta tecnologia primero."; } else tooltip = "Granja"; if (GUILayout.Button (new GUIContent ("", tooltip), "BotonInsertarGranja")) { TipoEdificio temp = principal.vida.tiposEdificios[2]; int eneTemp = temp.energiaConsumidaAlCrear; int compBasTemp = temp.compBasConsumidosAlCrear; int compAdvTemp = temp.compAvzConsumidosAlCrear; int matBioTemp = temp.matBioConsumidoAlCrear; if (!principal.recursosSuficientes(eneTemp, compBasTemp, compAdvTemp, matBioTemp)) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.granja; modeloInsercion = principal.vida.tiposEdificios[2].modelos[UnityEngine.Random.Range (0, principal.vida.tiposEdificios[2].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); //principal.objetoRoca.renderer.sharedMaterials[3].SetFloat("_FiltroOn", 1); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.granja; seleccionarObjetoInsercion (); } GUI.enabled = true; GUILayout.Space (cuantoW); if (etapaJuego < tEtapaJuego.mejoraAvanzadosComprada) { GUI.enabled = false; tooltip = "Debes investigar esta tecnologia primero."; } else tooltip = "Fábrica de componentes avanzados"; if (GUILayout.Button (new GUIContent ("", tooltip), "BotonInsertarFabComAdv")) { TipoEdificio temp = principal.vida.tiposEdificios[3]; int eneTemp = temp.energiaConsumidaAlCrear; int compBasTemp = temp.compBasConsumidosAlCrear; int compAdvTemp = temp.compAvzConsumidosAlCrear; int matBioTemp = temp.matBioConsumidoAlCrear; if (!principal.recursosSuficientes(eneTemp, compBasTemp, compAdvTemp, matBioTemp)) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.fabricaCompAdv; modeloInsercion = principal.vida.tiposEdificios[3].modelos[UnityEngine.Random.Range (0, principal.vida.tiposEdificios[3].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); //principal.objetoRoca.renderer.sharedMaterials[3].SetFloat("_FiltroOn", 1); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.fabricaCompAdv; seleccionarObjetoInsercion (); } GUI.enabled = true; GUILayout.Space (cuantoW); if (etapaJuego < tEtapaJuego.mejoraAvanzadosComprada) { GUI.enabled = false; tooltip = "Debes investigar esta tecnologia primero."; } else tooltip = "Central de energía avanzada"; if (GUILayout.Button (new GUIContent ("", tooltip), "BotonInsertarCenEnAdv")) { TipoEdificio temp = principal.vida.tiposEdificios[4]; int eneTemp = temp.energiaConsumidaAlCrear; int compBasTemp = temp.compBasConsumidosAlCrear; int compAdvTemp = temp.compAvzConsumidosAlCrear; int matBioTemp = temp.matBioConsumidoAlCrear; if (!principal.recursosSuficientes(eneTemp, compBasTemp, compAdvTemp, matBioTemp)) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } accion = taccion.insertar; elementoInsercion = telementoInsercion.centralEnergiaAdv; modeloInsercion = principal.vida.tiposEdificios[4].modelos[UnityEngine.Random.Range (0, principal.vida.tiposEdificios[4].modelos.Count)]; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); //principal.objetoRoca.renderer.sharedMaterials[3].SetFloat("_FiltroOn", 1); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.insercion; elementoInsercionDerecho = InterfazPrincipal.telementoInsercion.centralEnergiaAdv; seleccionarObjetoInsercion (); } GUI.enabled = true; GUILayout.Space (cuantoW); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.EndVertical (); GUILayout.EndArea (); break; case taccion.seleccionarMejora: mejoraHover = -1; GUILayout.BeginArea (new Rect (cuantoW * 22, cuantoH * posicionBloqueMejoras, cuantoW * 36, cuantoH * 7), new GUIContent (), "BloqueSeleccionMejoras"); GUILayout.BeginVertical (); GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW * 6.5f); //Sensores ----------------------------------------------------- if (mejoras.mejorasCompradas[0]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Sistema de Sondeo General"), "BotonMejoraInformacion")) { List<int> costeT = mejoras.getCosteMejora(0); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora0(); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 0; List<int> costeT = mejoras.getCosteMejora(0); infoSeleccion.Clear(); infoSeleccion.Add("Sistema de Sondeo General"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[0] || mejoras.mejorasCompradas[1]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Deteccion de Ecosistemas"), "BotonMejoraHabitats")) { List<int> costeT = mejoras.getCosteMejora(1); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora1 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 1; List<int> costeT = mejoras.getCosteMejora(1); infoSeleccion.Clear(); infoSeleccion.Add("Deteccion de Ecosistemas"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[0] || mejoras.mejorasCompradas[2]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Espectometro"), "BotonMejoraMetalesRaros")) { List<int> costeT = mejoras.getCosteMejora(2); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora2 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 2; List<int> costeT = mejoras.getCosteMejora(2); infoSeleccion.Clear(); infoSeleccion.Add("Espectometro"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[0] || mejoras.mejorasCompradas[3]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Sensor Biometrico"), "BotonMejoraVida")) { List<int> costeT = mejoras.getCosteMejora(3); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora3 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 3; List<int> costeT = mejoras.getCosteMejora(3); infoSeleccion.Clear(); infoSeleccion.Add("Sensor Biometrico"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW * 6); //Motores ------------------------------------------------------ //Se pueden añadir mas condiciones como el coste if (mejoras.mejorasCompradas[4]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Motores auxiliares Basicos"), "BotonMejoraMotor1")) { List<int> costeT = mejoras.getCosteMejora(4); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora4 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 4; List<int> costeT = mejoras.getCosteMejora(4); infoSeleccion.Clear(); infoSeleccion.Add("Motores auxiliares Basicos"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[4] || mejoras.mejorasCompradas[5]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Motores Orbitales"), "BotonMejoraMotor2")) { List<int> costeT = mejoras.getCosteMejora(5); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora5 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 5; List<int> costeT = mejoras.getCosteMejora(5); infoSeleccion.Clear(); infoSeleccion.Add("Motores Orbitales"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (mejoras.mejorasCompradas[6]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Aislamiento magnético"), "BotonMejoraMotor3")) { List<int> costeT = mejoras.getCosteMejora(6); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora6 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 6; List<int> costeT = mejoras.getCosteMejora(6); infoSeleccion.Clear(); infoSeleccion.Add("Aislamiento magnético"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (mejoras.mejorasCompradas[7]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Subir la nave de órbita"), "BotonMejoraMotor4")) { List<int> costeT = mejoras.getCosteMejora(7); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora7 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 7; List<int> costeT = mejoras.getCosteMejora(7); infoSeleccion.Clear(); infoSeleccion.Add("Subir la nave de órbita"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW * 1.5f); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW * 6.5f); //Energia ------------------------------------------------------ if (mejoras.mejorasCompradas[8]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Condensador Auxiliar"), "BotonMejoraEnergia1")) { List<int> costeT = mejoras.getCosteMejora(8); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora8 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 8; List<int> costeT = mejoras.getCosteMejora(8); infoSeleccion.Clear(); infoSeleccion.Add("Condensador Auxiliar"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (mejoras.mejorasCompradas[9]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Acumulador de Energia en Anillo"), "BotonMejoraEnergia2")) { List<int> costeT = mejoras.getCosteMejora(9); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora9 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 9; List<int> costeT = mejoras.getCosteMejora(9); infoSeleccion.Clear(); infoSeleccion.Add("Acumulador de Energia en Anillo"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[9] || mejoras.mejorasCompradas[10]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Array de Paneles Solares"), "BotonMejoraEnergia3")) { List<int> costeT = mejoras.getCosteMejora(10); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora10 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 10; List<int> costeT = mejoras.getCosteMejora(10); infoSeleccion.Clear(); infoSeleccion.Add("Array de Paneles Solares"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[8] || !mejoras.mejorasCompradas[9] || !mejoras.mejorasCompradas[10] || mejoras.mejorasCompradas[11]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Generador de Fusión"), "BotonMejoraEnergia4")) { List<int> costeT = mejoras.getCosteMejora(11); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora11 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 11; List<int> costeT = mejoras.getCosteMejora(11); infoSeleccion.Clear(); infoSeleccion.Add("Generador de Fusión"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW * 6); //Almacenamiento ----------------------------------------------- if (mejoras.mejorasCompradas[13] || etapaJuego < tEtapaJuego.fabCompBasConstruida) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Tecnologia de Material Biologico"), "BotonMejoraAlmacen1")) { List<int> costeT = mejoras.getCosteMejora(13); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora13 (); if (etapaJuego == tEtapaJuego.fabCompBasConstruida) etapaJuego = tEtapaJuego.mejoraBiologicoComprada; } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 13; List<int> costeT = mejoras.getCosteMejora(13); infoSeleccion.Clear(); infoSeleccion.Add("Contenedor biologico"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (mejoras.mejorasCompradas[12] || !mejoras.mejorasCompradas[13]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Tecnologia de Componentes Avanzados"), "BotonMejoraAlmacen2")) { List<int> costeT = mejoras.getCosteMejora(12); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora12 (); etapaJuego = tEtapaJuego.mejoraAvanzadosComprada; } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 12; List<int> costeT = mejoras.getCosteMejora(12); infoSeleccion.Clear(); infoSeleccion.Add("Contenedor avanzado"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[12] || !mejoras.mejorasCompradas[13] || mejoras.mejorasCompradas[14]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Ampliacion de Carga 1"), "BotonMejoraAlmacen3")) { List<int> costeT = mejoras.getCosteMejora(14); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora14 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 14; List<int> costeT = mejoras.getCosteMejora(14); infoSeleccion.Clear(); infoSeleccion.Add("Ampliacion de Carga 1"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[14] || mejoras.mejorasCompradas[15]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Ampliacion de Carga 2"), "BotonMejoraAlmacen4")) { List<int> costeT = mejoras.getCosteMejora(15); if (!principal.recursosSuficientes(costeT[0], costeT[1], costeT[2], costeT[3])) { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); break; } principal.consumeRecursos(costeT[0], costeT[1], costeT[2], costeT[3]); mejoras.compraMejora15 (); } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.mejoras; mejoraHover = 15; List<int> costeT = mejoras.getCosteMejora(15); infoSeleccion.Clear(); infoSeleccion.Add("Ampliacion de Carga 2"); infoSeleccion.Add(mejoras.getDescripcionMejora(mejoraHover)); infoSeleccion.Add(costeT[0].ToString()); //Coste ener infoSeleccion.Add(costeT[1].ToString()); //Coste comp bas infoSeleccion.Add(costeT[2].ToString()); //comp adv infoSeleccion.Add(costeT[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW * 1.5f); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.EndVertical (); GUILayout.EndArea (); break; case taccion.seleccionarHabilidad: habilidadHover = -1; GUILayout.BeginArea (new Rect (cuantoW * 22, cuantoH * posicionBloque, cuantoW * 36, cuantoH * 4), new GUIContent (), "BloqueSeleccionHabilidades"); GUILayout.BeginVertical (); GUILayout.Space (cuantoH); GUILayout.BeginHorizontal (GUILayout.Height (cuantoH * 2)); GUILayout.Space (cuantoW * 1.5f); if (!mejoras.mejorasCompradas[1] && !mejoras.mejorasCompradas[2] && !mejoras.mejorasCompradas[3]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Desactiva todos los filtros"), "BotonHabilidadVisionNormal")) { for(int i = 0; i < togglesFiltros.Length; i++) togglesFiltros[i] = false; materiales.habitats.SetFloat ("_FiltroOn", 0.0f); materiales.recursos.SetFloat ("_ComunesOn", 0.0f); materiales.recursos.SetFloat ("_RarosOn", 0.0f); materiales.recursos.SetFloat ("_EdificiosOn", 0.0f); for (int i = 0; i < materiales.plantas.Count; i++) { materiales.plantas[i].SetFloat ("_FiltroOn", 0.0f); materiales.plantas[i].SetColor ("_Tinte", Color.white); } for (int i = 0; i < materiales.herbivoros.Count; i++) { materiales.herbivoros[i].SetFloat ("_FiltroOn", 0.0f); materiales.herbivoros[i].SetColor ("_Tinte", Color.white); } for (int i = 0; i < materiales.carnivoros.Count; i++) { materiales.carnivoros[i].SetFloat ("_FiltroOn", 0.0f); materiales.carnivoros[i].SetColor ("_Tinte", Color.white); } } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[2]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa filtro de recursos"), "BotonHabilidadFiltroRecursos")) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.filtroRecursos; } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[1]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa filtro de hábitats"), "BotonHabilidadFiltroHabitats")) { if (materiales.habitats.GetFloat ("_FiltroOn") == 0.0f) { filtroHabitats = true; materiales.habitats.SetFloat ("_FiltroOn", 1.0f); } else { filtroHabitats = false; materiales.habitats.SetFloat ("_FiltroOn", 0.0f); } } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[3]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa filtro de vegetales"), "BotonHabilidadFiltroVegetales")) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.filtroVegetales; } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[3]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa filtro de animales"), "BotonHabilidadFiltroAnimales")) { tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.filtroAnimales; } GUI.enabled = true; GUILayout.Space (cuantoW * 3); if (!mejoras.mejorasCompradas[8]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa el Foco Solar"), "BotonHabilidad6")) { if (Camera.main.light.enabled) { habilidadFoco = false; Camera.main.light.enabled = false; } else { habilidadFoco = true; Camera.main.light.enabled=true; } } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { habilidadHover = 0; tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.habilidades; infoSeleccion.Clear(); infoSeleccion.Add("Foco Solar"); infoSeleccion.Add(mejoras.getDescripcionHabilidad(habilidadHover)); infoSeleccion.Add("10"); //Coste ener infoSeleccion.Add("0"); //Coste comp bas infoSeleccion.Add("0"); //comp adv infoSeleccion.Add("0"); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[10] && !fertilizanteActivo) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa el Fertilizante Ecoquímico"), "BotonHabilidad7")) { List<int> costes = mejoras.costeHab5; if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { accion = InterfazPrincipal.taccion.lanzarFertilizante; } else { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); } } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { habilidadHover = 1; tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.habilidades; List<int> costes = mejoras.costeHab5; infoSeleccion.Clear(); infoSeleccion.Add("Fertilizante Ecoquimico"); infoSeleccion.Add(mejoras.getDescripcionHabilidad(habilidadHover)); infoSeleccion.Add(costes[0].ToString()); //Coste ener infoSeleccion.Add(costes[1].ToString()); //Coste comp bas infoSeleccion.Add(costes[2].ToString()); //comp adv infoSeleccion.Add(costes[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[10] && !virusActivo) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa el Virus Selectivo Poblacional"), "BotonHabilidad8")) { List<int> costes = mejoras.costeHab7; if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { accion = InterfazPrincipal.taccion.lanzarVirus; } else { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); } } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { habilidadHover = 3; tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.habilidades; List<int> costes = mejoras.costeHab7; infoSeleccion.Clear(); infoSeleccion.Add("Virus pandemico"); infoSeleccion.Add(mejoras.getDescripcionHabilidad(habilidadHover)); infoSeleccion.Add(costes[0].ToString()); //Coste ener infoSeleccion.Add(costes[1].ToString()); //Coste comp bas infoSeleccion.Add(costes[2].ToString()); //comp adv infoSeleccion.Add(costes[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[11]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa la Bomba de Implosión Controlada"), "BotonHabilidad9")) { List<int> costes = mejoras.costeHab6; if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { accion = InterfazPrincipal.taccion.lanzarBomba; } else { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); } } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { habilidadHover = 2; tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.habilidades; List<int> costes = mejoras.costeHab6; infoSeleccion.Clear(); infoSeleccion.Add("Bomba de implosion"); infoSeleccion.Add(mejoras.getDescripcionHabilidad(habilidadHover)); infoSeleccion.Add(costes[0].ToString()); //Coste ener infoSeleccion.Add(costes[1].ToString()); //Coste comp bas infoSeleccion.Add(costes[2].ToString()); //comp adv infoSeleccion.Add(costes[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW); if (!mejoras.mejorasCompradas[11]) GUI.enabled = false; if (GUILayout.Button (new GUIContent ("", "Activa el Portal Espacio/temporal (finaliza la partida)"), "BotonHabilidad10")) { List<int> costes = mejoras.costeHab8; if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) { accion = InterfazPrincipal.taccion.insertarPortal; modeloInsercion = GameObject.FindGameObjectWithTag("ModelosEdificios").GetComponent<ModelosEdificios>().portal; modeloInsercion = FuncTablero.creaMesh (new Vector3 (0, 0, 0), modeloInsercion); } else { sonidoFX.GetComponent<Audio_SoundFX>().playNumber(2); } } if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition)) { habilidadHover = 4; tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.habilidades; List<int> costes = mejoras.costeHab8; infoSeleccion.Clear(); infoSeleccion.Add("Portal espacio-temporal"); infoSeleccion.Add(mejoras.getDescripcionHabilidad(habilidadHover)); infoSeleccion.Add(costes[0].ToString()); //Coste ener infoSeleccion.Add(costes[1].ToString()); //Coste comp bas infoSeleccion.Add(costes[2].ToString()); //comp adv infoSeleccion.Add(costes[3].ToString()); //mat bio } GUI.enabled = true; GUILayout.Space (cuantoW * 1.5f); GUILayout.EndHorizontal (); GUILayout.Space (cuantoH); GUILayout.EndVertical (); GUILayout.EndArea (); break; default: break; } }