void OnGUI()
    {
        if (accionAnterior != accion) {
            forzarTooltip = false;
            actualizarEstilosBotones ();
            if (accionAnterior == taccion.insertar && modeloInsercion != null)
                Destroy (modeloInsercion);
            accionAnterior = accion;
        }
        GUI.skin = estilo;
        if (etapaJuego == InterfazPrincipal.tEtapaJuego.portalConstruido) {
            menuFinalizar();
        }
        aspectRatioNumerico = (float)Screen.width / (float)Screen.height;
        //16:9
        if (aspectRatioNumerico >= 1.69) {
            aspectRatio = taspectRatio.aspectRatio16_9;
            cuantoW = (float)Screen.width / 80;
            cuantoH = (float)Screen.height / 45;
            //16:10
        } else if (aspectRatioNumerico >= 1.47) {
            aspectRatio = taspectRatio.aspectRatio16_10;
            cuantoW = (float)Screen.width / 80;
            cuantoH = (float)Screen.height / 50;
            //4:3
        } else {
            aspectRatio = taspectRatio.aspectRatio4_3;
            cuantoW = (float)Screen.width / 80;
            cuantoH = (float)Screen.height / 60;
        }
        if (accion == InterfazPrincipal.taccion.mostrarMenu)
            bloqueMenu ();
        bloqueSuperior ();
        bloqueIzquierdo ();
        bloqueSeleccion ();
        bloqueInformacion ();
        bloqueDerecho ();

        if (posicionFueraDeInterfaz (Input.mousePosition)) {
            mostrarInfoCasilla = true;
            if (accion == taccion.insertar)
                insertarElemento ();
            else if (accion == taccion.lanzarVirus)
                insertarVirus();
            else if (accion == taccion.lanzarFertilizante)
                insertarFertilizante();
            else if (accion == taccion.lanzarBomba)
                insertarBomba();
            else if (accion == taccion.insertarPortal)
                insertarPortal();
            else if (Input.GetMouseButtonDown (0)) {
                //Se ha hecho click en el tablero sin insertar nada
                if (seleccionarObjetoTablero ())
                    tipoMenuDerecho = InterfazPrincipal.tMenuDerecho.seleccion;
            }
        } else
            mostrarInfoCasilla = false;

        if (forzarTooltip)
            GUI.Box (new Rect (Input.mousePosition.x - cuantoW, Screen.height - Input.mousePosition.y - cuantoH, cuantoW * 2, cuantoH * 2), new GUIContent ("", mensajeForzarTooltip), "LabelReducido");
        if (activarTooltip)
            mostrarToolTip ();
    }
    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);
                }
            }
        }
    }
    /*
     * asik a fertilizante me tiene k llegar especieanimal especievegetal y factor
    rantamplan: y a bomba posx y posy
    rantamplan: y a virus
    rantamplan: especieanimal

    fertilizanteBioQuimico(EspecieVegetal especieVegetal,EspecieAnimal especieAnimal, float factor)

    rantamplan: virusSelectivoPoblacional(EspecieAnimal especie, float factor)
    rantamplan: public void bombaImplosion(int posX,int posy)
    */
    private void insertarVirus()
    {
        if (accion == taccion.lanzarVirus) {
            int posX = 0;
            int posY = 0;
            RaycastHit hit;
            if (principal.raycastRoca (Input.mousePosition, ref posX, ref posY, out hit)) {
                animalVirus = principal.vida.tablero[posY, posX].animal;
                if (Input.GetMouseButton (0)) {
                    if (animalVirus != null) {
                        List<int> costes = mejoras.costeHab7;
                        if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) {
                            principal.consumeRecursos(costes[0], costes[1], costes[2], costes[3]);
                            principal.vida.virusSelectivoPoblacional(animalVirus, factorVirusPos);
                            turnoVirus = principal.numPasos;
                            virusActivo = true;
                        }
                        else {	//No hay recursos suficientes

                        }
                    }
                    else {	//No hay nada en esa casilla
                        Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> ();
                        efectos.playNumber (Random.Range (1, 3));
                    }
                    accion = taccion.ninguna;
                }
            }
        }
    }
    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 insertarFertilizante()
 {
     if (accion == taccion.lanzarFertilizante) {
         int posX = 0;
         int posY = 0;
         RaycastHit hit;
         if (principal.raycastRoca (Input.mousePosition, ref posX, ref posY, out hit)) {
             vegetalFertilizante = principal.vida.tablero[posY, posX].vegetal;
             animalFertilizante = principal.vida.tablero[posY, posX].animal;
             if (Input.GetMouseButton (0)) {
                 if (vegetalFertilizante != null || animalFertilizante != null) {
                     List<int> costes = mejoras.costeHab5;
                     if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) {
                         principal.consumeRecursos(costes[0], costes[1], costes[2], costes[3]);
                         principal.vida.fertilizanteBioQuimico(vegetalFertilizante, animalFertilizante, factorFertilizantePos);
                         turnoFertilizante = principal.numPasos;
                         fertilizanteActivo = true;
                     }
                 }
                 else {
                     Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> ();
                     efectos.playNumber (Random.Range (1, 3));
                 }
                 accion = taccion.ninguna;
             }
         }
     }
 }
    private void insertarBomba()
    {
        if (accion == taccion.lanzarBomba) {
            int posX = 0;
            int posY = 0;
            RaycastHit hit;
            if (principal.raycastRoca (Input.mousePosition, ref posX, ref posY, out hit)) {
                if (Input.GetMouseButton (0)) {
                    List<int> costes = mejoras.costeHab6;
                    if (principal.recursosSuficientes(costes[0], costes[1], costes[2], costes[3])) {
                        principal.consumeRecursos(costes[0], costes[1], costes[2], costes[3]);
                        principal.vida.bombaImplosion(posY, posX);
                        accion = taccion.ninguna;
                        GameObject particula = GameObject.FindGameObjectWithTag("Particulas").GetComponent<Particulas>().explosion;

                        Instantiate(particula, hit.point, Quaternion.LookRotation(Camera.main.transform.up));
                    }

                    else {
                        Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> ();
                        efectos.playNumber (Random.Range (1, 3));
                    }
                }
            }
        }
    }
 //Dibuja el bloque superior de la ventana que contiene: tiempo, control velocidad, conteo de recursos y menu principal
 private void bloqueSuperior()
 {
     float ajusteRecursos = 0;
     GUI.BeginGroup (new Rect (cuantoW * 0, cuantoH * 0, cuantoW * 80, cuantoH * 4));
     GUI.Box (new Rect (cuantoW * 0, cuantoH * 0, cuantoW * 73, cuantoH * 4), "", "BloqueSuperior");
     //Tiempo
     GUI.Label (new Rect (cuantoW * 2, cuantoH * 0, cuantoW * 6, cuantoH * 2), principal.numPasos.ToString (), "EtiquetaTiempo");
     /* [Aris]
      * He creado el metodo para formatear la fecha y que no salga solo un numero cutre, pero ahora mismo
      * no hay espacio en la cabecera. Lo dejo aqui comentado para que comentes una y descomentes la otra
      * si te animas ;)
      */
     //		GUI.Label(new Rect(cuantoW*2,cuantoH*0,cuantoW*6,cuantoH*2),FuncTablero.formateaFechaPasos(principal.numPasos),"EtiquetaTiempo");
     //Velocidad
     if (GUI.Button (new Rect (cuantoW * 3, cuantoH * 2, cuantoW * 1, cuantoH * 1), new GUIContent ("", "Pausa el juego"), "BotonPausa"))
         principal.setEscalaTiempo (0.0f);
     if (GUI.Button (new Rect (cuantoW * 4, cuantoH * 2, cuantoW * 1, cuantoH * 1), new GUIContent ("", "Velocidad normal"), "BotonVelocidad1"))
         principal.setEscalaTiempo (1.0f);
     if (GUI.Button (new Rect (cuantoW * 5, cuantoH * 2, cuantoW * 1, cuantoH * 1), new GUIContent ("", "Velocidad 2x"), "BotonVelocidad2"))
         principal.setEscalaTiempo (2.0f);
     if (GUI.Button (new Rect (cuantoW * 6, cuantoH * 2, cuantoW * 1, cuantoH * 1), new GUIContent ("", "Velocidad 5x"), "BotonVelocidad5"))
         principal.setEscalaTiempo (5.0f);
     //Energia
     GUI.Box (new Rect (cuantoW * 12, cuantoH * 0, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Energía"), "IconoEnergia");
     GUI.Box (new Rect (cuantoW * 14, cuantoH * 0, cuantoW * 7, cuantoH * 2), new GUIContent ("", principal.energia.ToString () + "/" + principal.energiaMax.ToString ()), "BoxEnergia");
     ajusteRecursos = (System.Math.Abs (principal.energiaDif) < 100) ? 0 : 0.5f;
     GUI.Label (new Rect (cuantoW * 14, cuantoH * 0, cuantoW * (5 - ajusteRecursos), cuantoH * 2), principal.energia.ToString (), "LabelEnergia");
     if (principal.energiaDif >= 0)
         GUI.Label (new Rect (cuantoW * (19 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "+" + principal.energiaDif.ToString (), "LabelRecursosDifVerde");
     else
         GUI.Label (new Rect (cuantoW * (19 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "" + principal.energiaDif.ToString (), "LabelRecursosDifRojo");
     //Componentes basicos
     GUI.Box (new Rect (cuantoW * 22, cuantoH * 0, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Componentes básicos"), "IconoCompBas");
     GUI.Box (new Rect (cuantoW * 24, cuantoH * 0, cuantoW * 7, cuantoH * 2), new GUIContent ("", principal.componentesBasicos.ToString () + "/" + principal.componentesBasicosMax.ToString ()), "BoxCompBas");
     ajusteRecursos = (System.Math.Abs (principal.componentesBasicosDif) < 100) ? 0 : 0.5f;
     GUI.Label (new Rect (cuantoW * 24, cuantoH * 0, cuantoW * (5 - ajusteRecursos), cuantoH * 2), principal.componentesBasicos.ToString (), "LabelCompBas");
     if (principal.componentesBasicosDif >= 0)
         GUI.Label (new Rect (cuantoW * (29 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "+" + principal.componentesBasicosDif.ToString (), "LabelRecursosDifVerde");
     else
         GUI.Label (new Rect (cuantoW * (29 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "" + principal.componentesBasicosDif.ToString (), "LabelRecursosDifRojo");
     //Componentes avanzados
     GUI.Box (new Rect (cuantoW * 32, cuantoH * 0, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Componentes avanzados"), "IconoCompAdv");
     GUI.Box (new Rect (cuantoW * 34, cuantoH * 0, cuantoW * 7, cuantoH * 2), new GUIContent ("", principal.componentesAvanzados.ToString () + "/" + principal.componentesAvanzadosMax.ToString ()), "BoxCompAdv");
     ajusteRecursos = (System.Math.Abs (principal.componentesAvanzadosDif) < 100) ? 0 : 0.5f;
     GUI.Label (new Rect (cuantoW * 34, cuantoH * 0, cuantoW * (5 - ajusteRecursos), cuantoH * 2), principal.componentesAvanzados.ToString (), "LabelCompAdv");
     if (principal.componentesAvanzadosDif >= 0)
         GUI.Label (new Rect (cuantoW * (39 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "+" + principal.componentesAvanzadosDif.ToString (), "LabelRecursosDifVerde");
     else
         GUI.Label (new Rect (cuantoW * (39 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "" + principal.componentesAvanzadosDif.ToString (), "LabelRecursosDifRojo");
     //Material biologico
     GUI.Box (new Rect (cuantoW * 42, cuantoH * 0, cuantoW * 2, cuantoH * 2), new GUIContent ("", "Material biológico"), "IconoMatBio");
     GUI.Box (new Rect (cuantoW * 44, cuantoH * 0, cuantoW * 7, cuantoH * 2), new GUIContent ("", principal.materialBiologico.ToString () + "/" + principal.materialBiologicoMax.ToString ()), "BoxMatBio");
     ajusteRecursos = (System.Math.Abs (principal.materialBiologicoDif) < 100) ? 0 : 0.5f;
     GUI.Label (new Rect (cuantoW * 44, cuantoH * 0, cuantoW * (5 - ajusteRecursos), cuantoH * 2), principal.materialBiologico.ToString (), "LabelMatBio");
     if (principal.materialBiologicoDif >= 0)
         GUI.Label (new Rect (cuantoW * (49 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "+" + principal.materialBiologicoDif.ToString (), "LabelRecursosDifVerde");
     else
         GUI.Label (new Rect (cuantoW * (49 - ajusteRecursos), cuantoH * 0, cuantoW * (2 + ajusteRecursos), cuantoH * 2), "" + principal.materialBiologicoDif.ToString (), "LabelRecursosDifRojo");
     //Menu
     if (GUI.Button (new Rect (cuantoW * 73, cuantoH * 0, cuantoW * 7, cuantoH * 4), new GUIContent ("", "Accede al menu del juego"), "BotonMenu")) {
         escalaTiempoAntesMenu = principal.escalaTiempo;
         principal.setEscalaTiempo (0);
         accion = InterfazPrincipal.taccion.mostrarMenu;
         accionMenu = InterfazPrincipal.taccionMenu.mostrarMenu;
     }
     GUI.EndGroup ();
 }
    //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;
        }
    }
    //Dibuja el menu de opciones que contiene Guardar, Opciones de audio, Menu Principal, Salir, Volver
    private void bloqueMenu()
    {
        float posicionBloque = 0;
        float posicionConfirmar = 0;
        float posicionAudio = 0;
        float posicionGuardar = 0;
        switch (aspectRatio) {
        case taspectRatio.aspectRatio16_9:
            posicionBloque = 13.5f;
            posicionConfirmar = 19.5f;
            posicionAudio = 16.5f;
            posicionGuardar = 14.5f;
            break;
        case taspectRatio.aspectRatio16_10:
            posicionBloque = 16;
            posicionConfirmar = 22;
            posicionAudio = 19;
            posicionGuardar = 17;
            break;
        case taspectRatio.aspectRatio4_3:
            posicionBloque = 21;
            posicionConfirmar = 27;
            posicionAudio = 24;
            posicionGuardar = 22;
            break;
        default:
            break;
        }

        switch (accionMenu) {
        case taccionMenu.mostrarMenu:
            GUILayout.BeginArea (new Rect (cuantoW * 32.5f, cuantoH * posicionBloque, cuantoW * 15, cuantoH * 18), new GUIContent ());
            GUILayout.BeginVertical ();
            GUILayout.Box (new GUIContent (), "BloqueMenu", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15));
            if (GUILayout.Button (new GUIContent ("Guardar partida", "Accede al menu para guardar tu partida"), "BotonGuardarPartida", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15)))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarGuardar;
            if (GUILayout.Button (new GUIContent ("Opciones de audio", "Lleva al menu de opciones de audio"), "BotonOpcionesAudio", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15)))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarOpcionesAudio;
            if (GUILayout.Button (new GUIContent ("Menu principal", "Lleva al menu principal del juego"), "BotonMenuPrincipal", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15)))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarSalirMenuPrincipal;
            if (GUILayout.Button (new GUIContent ("Salir del juego", "Cierra completamente el juego"), "BotonSalirJuego", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15)))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarSalirJuego;
            if (GUILayout.Button (new GUIContent ("Volver", "Vuelve a la partida"), "BotonVolver", GUILayout.Height (cuantoH * 3), GUILayout.Width (cuantoW * 15))) {
                accion = InterfazPrincipal.taccion.ninguna;
                principal.setEscalaTiempo (escalaTiempoAntesMenu);
            }
            GUILayout.EndVertical ();
            GUILayout.EndArea ();
            if (GUI.Button (new Rect (0, 0, cuantoW * 80, cuantoH * 60), new GUIContent (), "EstiloVacio")) {
                ;
                //CLINK -> Control para que no se pulse fuera del menú (Buena idea!)
            }
            break;

        case taccionMenu.mostrarGuardar:
            GUI.Box (new Rect (cuantoW * 31, cuantoH * posicionGuardar, cuantoW * 18, cuantoH * 14), new GUIContent (""), "BoxGuardar");
            posicionScroll = GUI.BeginScrollView (new Rect (cuantoW * 31, cuantoH * posicionGuardar, cuantoW * 18, cuantoH * 12), posicionScroll, new Rect (0, 0, cuantoW * 18, cuantoH * 4 * numSavesExtra));
            if (GUI.Button (new Rect (cuantoW * 3, 0, cuantoW * 12, cuantoH * 3), new GUIContent ("Nueva partida salvada", "Guardar una nueva partida"))) {
                GameObject contenedor = GameObject.FindGameObjectWithTag ("Carga");
                ValoresCarga temp = contenedor.GetComponent<ValoresCarga> ();
                principal.rellenaContenedor (ref temp);
                string fecha = System.DateTime.Now.ToString ().Replace ("\\", "").Replace ("/", "").Replace (" ", "").Replace (":", "");
                SaveLoad.cambiaFileName ("Partida" + fecha + ".hur");
                SaveLoad.Save (temp);
                //Recargar los saves para actualizar estado
                numSaves = SaveLoad.FileCount ();
                nombresSaves = new string[numSaves];
                nombresSaves = SaveLoad.getFileNames ();
                numSavesExtra = numSaves - 3;
                if (numSavesExtra < 0)
                    numSavesExtra = 0;
                //Recuperar estado normal
                accion = InterfazPrincipal.taccion.ninguna;
                principal.setEscalaTiempo (escalaTiempoAntesMenu);
            }
            for (int i = 0; i < numSaves; i++) {
                if (GUI.Button (new Rect (cuantoW * 3, (i + 1) * cuantoH * 3, cuantoW * 12, cuantoH * 3), new GUIContent (nombresSaves[i], "Sobreescribir partida num. " + i))) {
                    GameObject contenedor = GameObject.FindGameObjectWithTag ("Carga");
                    ValoresCarga temp = contenedor.GetComponent<ValoresCarga> ();
                    principal.rellenaContenedor (ref temp);
                    SaveLoad.cambiaFileName (nombresSaves[i]);
                    SaveLoad.Save (temp);
                    //Recuperar estado normal
                    accion = InterfazPrincipal.taccion.ninguna;
                    principal.setEscalaTiempo (escalaTiempoAntesMenu);
                }
            }

            GUI.EndScrollView ();
            if (GUI.Button (new Rect (cuantoW * 44, cuantoH * (posicionGuardar + 13), cuantoW * 5, cuantoH * 2), new GUIContent ("Volver", "Pulsa aquí para volver al menu de opciones"))) {
                accionMenu = InterfazPrincipal.taccionMenu.mostrarMenu;
            }
            break;
        case taccionMenu.mostrarOpcionesAudio:
            GUI.Box (new Rect (cuantoW * 32.5f, cuantoH * posicionAudio, cuantoW * 15, cuantoH * 12), new GUIContent (), "BoxOpcionesAudio");
            /*GUI.Label(new Rect(cuantoW*34f,cuantoH*(posicionAudio),cuantoW*15.5f,cuantoH*2),new GUIContent("Sonido"));*/
            GUI.Label (new Rect (cuantoW * 34f, cuantoH * (posicionAudio + 2f), cuantoW * 9, cuantoH * 2), new GUIContent ("Volumen"));
            GUI.Label (new Rect (cuantoW * 34f, cuantoH * (posicionAudio + 4f), cuantoW * 6.5f, cuantoH * 2), new GUIContent ("Música"));
            musicaVol = GUI.HorizontalSlider (new Rect (cuantoW * 39f, cuantoH * (posicionAudio + 5f), cuantoW * 7, cuantoH * 2), musicaVol, 0, 1.0f);
            GUI.Label (new Rect (cuantoW * 34f, cuantoH * (posicionAudio + 6f), cuantoW * 5.5f, cuantoH * 2), new GUIContent ("Efectos"));
            sfxVol = GUI.HorizontalSlider (new Rect (cuantoW * 39f, cuantoH * (posicionAudio + 7f), cuantoW * 7, cuantoH * 2), sfxVol, 0, 1.0f);
            if (GUI.Button (new Rect (cuantoW * 41f, cuantoH * (posicionAudio + 9.5f), cuantoW * 5f, cuantoH * 2f), new GUIContent ("Volver", "Pulsa aquí para volver al menu de opciones")))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarMenu;

            if (GUI.changed) {
                //Volumen del audio ambiente
                Audio_Ambiente ambiente = sonidoAmbiente.GetComponent<Audio_Ambiente> ();
                if (musicaVol == 0)
                    ambiente.activado = false;
                else
                    ambiente.activado = true;
                ambiente.volumen = musicaVol;
                //Volumen del audio de efectos
                Audio_SoundFX efectos = sonidoFX.GetComponent<Audio_SoundFX> ();
                if (sfxVol == 0)
                    efectos.activado = false;
                else
                    efectos.activado = true;
                efectos.volumen = sfxVol;
            }
            break;
        case taccionMenu.mostrarSalirMenuPrincipal:
            GUI.Box (new Rect (cuantoW * 36, cuantoH * posicionConfirmar, cuantoW * 8, cuantoH * 4), new GUIContent (), "BoxConfirmacion");
            GUI.Label (new Rect (cuantoW * 37.5f, cuantoH * (posicionConfirmar), cuantoW * 6, cuantoH * 2), new GUIContent ("¿Está seguro?"));
            if (GUI.Button (new Rect (cuantoW * 37, cuantoH * (posicionConfirmar + 2), cuantoW * 2.5f, cuantoH * 1.5f), new GUIContent ("Si", "Pulsa aquí para salir al menu principal"))) {
                accion = InterfazPrincipal.taccion.ninguna;
                principal.setEscalaTiempo (1.0f);
                FuncTablero.quitaPerlin ();
                Application.LoadLevel ("Escena_Inicial");
            }
            if (GUI.Button (new Rect (cuantoW * 40.5f, cuantoH * (posicionConfirmar + 2), cuantoW * 2.5f, cuantoH * 1.5f), new GUIContent ("No", "Pulsa aquí para volver al menu de opciones")))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarMenu;
            break;
        case taccionMenu.mostrarSalirJuego:
            GUI.Box (new Rect (cuantoW * 36, cuantoH * posicionConfirmar, cuantoW * 8, cuantoH * 4), new GUIContent (), "BoxConfirmacion");
            GUI.Label (new Rect (cuantoW * 37.5f, cuantoH * (posicionConfirmar), cuantoW * 6, cuantoH * 2), new GUIContent ("¿Está seguro?"));
            if (GUI.Button (new Rect (cuantoW * 37, cuantoH * (posicionConfirmar + 2), cuantoW * 2.5f, cuantoH * 1.5f), new GUIContent ("Si", "Pulsa aquí para salir del juego"))) {
                PlayerPrefs.Save();
                Application.Quit ();
            }
            if (GUI.Button (new Rect (cuantoW * 40.5f, cuantoH * (posicionConfirmar + 2), cuantoW * 2.5f, cuantoH * 1.5f), new GUIContent ("No", "Pulsa aquí para volver al menu de opciones")))
                accionMenu = InterfazPrincipal.taccionMenu.mostrarMenu;
            break;
        default:
            break;
        }
    }
    //Dibuja el bloque izquierdo de la ventana que contiene: insertar vegetales o animales, insertar edificios, mejoras de la nave, habilidades, info/seleccionar
    private void bloqueIzquierdo()
    {
        int posicionBloque = 0;
        switch (aspectRatio) {
        case taspectRatio.aspectRatio16_9:
            posicionBloque = 17;
            break;
        case taspectRatio.aspectRatio16_10:
            posicionBloque = 20;
            break;
        case taspectRatio.aspectRatio4_3:
            posicionBloque = 25;
            break;
        default:
            break;
        }

        GUILayout.BeginArea (new Rect (cuantoW * 0, cuantoH * posicionBloque, cuantoW * 3, cuantoH * 10), new GUIContent (), "BloqueIzquierdo");
        GUILayout.BeginHorizontal ();
        if (mostrarBloqueIzquierdo) {
            GUILayout.BeginVertical (GUILayout.Height (cuantoH * 10), GUILayout.Width (cuantoH * 2));
            //Si no se ha llegado a la etapa de juego apropiada, no se pueden crear animales ni plantas
            if (etapaJuego < tEtapaJuego.mejoraBiologicoComprada)
                GUI.enabled = false;
            if (GUILayout.Button (new GUIContent ("", "Accede al menu de insertar vegetales"), "BotonInsertarVegetales")) {
                if (accion != taccion.seleccionarVegetal)
                    accion = taccion.seleccionarVegetal;
                else
                    accion = taccion.ninguna;
            }
            if (GUILayout.Button (new GUIContent ("", "Accede al menu de insertar animales"), "BotonInsertarAnimales")) {
                if (accion != taccion.seleccionarAnimal)
                    accion = taccion.seleccionarAnimal;
                else
                    accion = taccion.ninguna;
            }
            GUI.enabled = true;
            if (GUILayout.Button (new GUIContent ("", "Accede al menu de construir edificios"), "BotonInsertarEdificios")) {
                if (accion != taccion.seleccionarEdificio)
                    accion = taccion.seleccionarEdificio;
                else
                    accion = taccion.ninguna;
            }
            if (GUILayout.Button (new GUIContent ("", "Accede al menu de mejoras de la nave"), "BotonAccederMejoras")) {
                if (accion != taccion.seleccionarMejora)
                    accion = taccion.seleccionarMejora;
                else
                    accion = taccion.ninguna;
            }
            if (GUILayout.Button (new GUIContent ("", "Accede al menu de habilidades"), "BotonAccederHabilidades")) {
                if (accion != taccion.seleccionarHabilidad)
                    accion = taccion.seleccionarHabilidad;
                else
                    accion = taccion.ninguna;
            }
            GUILayout.EndVertical ();
            if (GUILayout.Button (new GUIContent ("", "Pulsa para ocultar este menu"), "BotonOcultarBloqueIzquierdo", GUILayout.Height (cuantoH * 10), GUILayout.Width (cuantoH * 1))) {
                mostrarBloqueIzquierdo = false;
                accion = taccion.ninguna;
            }
        } else if (GUILayout.Button (new GUIContent ("", "Pulsa para mostrar el menu de acciones"), "BotonOcultarBloqueIzquierdoActivado", GUILayout.Height (cuantoH * 10), GUILayout.Width (cuantoH * 1)))
            mostrarBloqueIzquierdo = true;

        GUILayout.EndHorizontal ();
        GUILayout.EndArea ();
    }