Exemple #1
0
 public bool Avance()
 {
     if (terminados.Count <= resul.Count * 0.2)         //el juego termina cuando quede el 20% de los ejercicios
     {
         detener = true;
         Vuforia.CameraDevice.Instance.Stop();
         GameObject.Find("ARCamera").GetComponent <Camera>().clearFlags = CameraClearFlags.Skybox;
         GameObject.Find("txtAviso").GetComponent <Text>().text         = "FIN DEL JUEGO";
         txtTarget.text = "FIN DEL JUEGO";
         PausarTiempo();
         int          pto = ((correctos * 2) - errores) * 100;
         GuardarDatos g   = new GuardarDatos("1", correctos, errores, pto, tiempo, 1, "Facil");
         g.Insert();
         return(false);
     }
     return(true);
 }
Exemple #2
0
    public bool Avance()
    {
        if (terminados.Count <= 2)
        {
            Vuforia.CameraDevice.Instance.Stop();
            GameObject.Find("ARCamera").GetComponent <Camera> ().clearFlags = CameraClearFlags.Skybox;
            detener = true;
            PausarTiempo();
            int pto = (correctos - errores) * 100;
            if (pto < 0)
            {
                pto = 0;
            }
            GuardarDatos g = new GuardarDatos("4", correctos, errores, pto, tiempo, 1, "Facil");
            g.Insert();

            GameObject.Find("txtAviso").GetComponent <Text> ().text = "FIN DEL JUEGO";
            pnlPausa.GetComponent <RectTransform> ().localScale     = Vector3.zero;
            txtTarget.text = "FIN DEL JUEGO";
            return(false);
        }
        return(true);
    }
Exemple #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (!terminada && currentAmount < 100f && GameObject.Find("Dropdown").GetComponent <RectTransform>().localScale == Vector3.zero)
        {
            Debug.Log(gameObject.name + " colisiona con " + other.name + "  Tag:" + other.GetComponent <Collider> ().tag + "  Target  " + tar);
            if (other.tag.Equals("Trigger") && other.name.Equals("Arenero") && gameObject.name.Equals("CuboArena"))
            {
                if (tar.Equals(""))
                {
                    tar = "Arenero";
                }

                if (tar.Equals("Arenero"))
                {
                    Debug.Log("Se ha cargado el cucharon de Arena");
                    //GameObject.FindGameObjectWithTag ("Mov1").GetComponent<MeshRenderer> ().material = mtArena;
                    //	GameObject.FindGameObjectWithTag ("Mov1").GetComponent<Transform> ().localScale = new Vector3 (1.2f, 1.2f, 1.1f);
                    cuboArena.GetComponent <MeshRenderer> ().material = mtArena;
                    cuboArena.tag = "Player";
                    tar           = "Contenedor";
                    lista         = true;
                    GameObject.Find("txtInstrucciones").GetComponent <Text>().text = "Colisiona el Marcador Cubo con el Contenedor";
                }
            }
            else if (other.tag.Equals("Player") && other.name.Equals("Contenedor") && lista &&
                     gameObject.name.Equals("CuboArena"))
            {
                Debug.Log("Se ha detectado el Tag " + other.tag + " en " + other.name + ".\t Target: " + tar);

                if (cuboArena.GetComponent <MeshRenderer> ().material.name.Contains("Arena") && tar.Equals("Contenedor"))
                {
                    //if (GameObject.FindGameObjectWithTag ("Mov1").GetComponent<MeshRenderer> ().material.name.Contains ("Arena") && tar.Equals ("Contenedor")) {
                    Debug.Log("Descargando el Cucharon en el Recipiente.");
                    getAltura();
                    BarraProgreso();
                    //	float ff = (currentAmount / 100f);

                    fig4.transform.localScale = new Vector3(4, currentAmount / 10f, 4);
                    //Aqui se cambia la posicion respecto de tablet y windows y mac
                    fig4.transform.localPosition = new Vector3(6.83f, (-6.39f + (currentAmount / 20f)), 24.9f);
                    //Aqui termina
                    cuboArena.tag = "Trigger";
                    tar           = "Arenero";
                    ncolisiones++;
                    cuboArena.GetComponent <MeshRenderer> ().material = blue;
                    //GameObject.FindGameObjectWithTag ("Mov1").GetComponent<MeshRenderer> ().material = null;
                    //GameObject.FindGameObjectWithTag ("Mov1").GetComponent<Transform> ().localScale = Vector3.zero;
                    Debug.Log("Avance  " + currentAmount);
                    lista = false;
                    if (currentAmount >= 100f)
                    {
                        GameObject.Find("pnlAyuda").GetComponent <RectTransform> ().localScale = new Vector3(0.25f, 0.3f, 0.1f);
                        if (excedente != 0)
                        {
                            GameObject.Find("txtAlerta").GetComponent <Text> ().text = "El Contenedor se ha llenado. \n Tu recipiente auxiliar tiene " + excedente + "% de excedente, excediste las dimeinsiones 3x10x3 del contenedor";
                        }
                        GameObject.Find("txtMensaje").GetComponent <Text> ().text = "Bravo. Alcanzaste la meta en " + ncolisiones + " pasos. \n" +
                                                                                    "Comenta con tus amigos que aprendiste.";
                        GameObject.Find("Arenero").GetComponent <Transform> ().localScale = Vector3.zero;
                        GameObject.Find("txtInstrucciones").GetComponent <Text>().text    = "El Contenedor se ha llenado. Lo Lograste.";
                        GameObject.Find("ARCamera").GetComponent <NoARCamera> ().enabled  = true;
                        //	GameObject.Find ("ARCamera").GetComponent<Camera> ().clearFlags = CameraClearFlags.Skybox;
                        Vuforia.CameraDevice.Instance.Stop();
                        GameObject.Find("ARCamera").GetComponent <Camera> ().clearFlags = CameraClearFlags.Skybox;
                        PausarTiempo();
                        GuardarDatos guardar = new GuardarDatos("2", ncolisiones, 0, (ncolisiones * 300), 0, 1, "Facil");
                        guardar.Insert();
                    }
                    else
                    {
                        GameObject.Find("txtInstrucciones").GetComponent <Text>().text = "Colisiona el Marcador Cubo con el Arenero";
                    }
                }
            }
            GameObject.Find("txtOpcion").GetComponent <Text> ().text = tar;
        }
        else if (currentAmount >= 100f)
        {
            GameObject.Find("pnlAyuda").GetComponent <RectTransform> ().localScale = new Vector3(0.25f, 0.3f, 0.1f);
            if (excedente != 0)
            {
                GameObject.Find("txtAlerta").GetComponent <Text> ().text = "El Contenedor se ha llenado. Tu recipiente auxiliar tiene " + excedente + "% de excedente, excediste las dimeinsiones 3x10x3 del contenedor";
            }
            GameObject.Find("txtMensaje").GetComponent <Text> ().text = "Bravo. Alcanzaste la meta en " + ncolisiones + " pasos. \n" +
                                                                        "Comenta con tus amigos que aprendiste.";
            GameObject.Find("Arenero").GetComponent <Transform> ().localScale = Vector3.zero;
            //GameObject.Find ("ARCamera").GetComponent<Camera> ().clearFlags = CameraClearFlags.Skybox;
            Vuforia.CameraDevice.Instance.Stop();
            GameObject.Find("ARCamera").GetComponent <Camera> ().clearFlags = CameraClearFlags.Skybox;
        }
    }
Exemple #4
0
    void Update()                               // Update is called once per frame
    {
        if (final >= 6)
        {
            PausarTiempo();
        }
        else
        {
            StartCoroutine("ControlTiempo");
        }


        if (Input.GetMouseButtonDown(0))
        {
            Ray        rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;
            if (Physics.Raycast(rayOrigin, out hitInfo))
            {
                Debug.DrawLine(transform.position, hitInfo.point, Color.red, 0.5f);
                string nom  = hitInfo.collider.gameObject.name;
                string nom2 = nom = nom.Substring(0, nom.Length - 1);

                if (!nom.Equals("GUI") && !nom.Equals("Plane"))
                {
                    txtFind.text = inf.getDescripcion(nom2);
                    Debug.Log("Detectado: " + hitInfo.collider.gameObject.name + ", Objetivo: " + target);
                    if (target.Equals(nom))
                    {
                        consecutivas++;
                        Debug.Log("Encontrada la parte " + consecutivas + " de 2 " + nom + ". Final " + final);
                        puntos += 100;
                        hitInfo.collider.gameObject.GetComponent <Transform> ().localScale = Vector3.zero;

                        inf.getDescripcion(nom2);
                        if (consecutivas == 1)
                        {
                            imgObjetivo.GetComponent <RectTransform> ().localScale = new Vector3(4f, 3f, 4f);
                            CambiarImg(target);
                        }

                        if (consecutivas == 2)
                        {
                            encontradas++;
                            GameObject.Find("txtAciertos").GetComponent <Text> ().text        = encontradas.ToString();
                            GameObject.Find(nom + "A").GetComponent <Transform> ().localScale = Vector3.one;
                            GameObject.Find(nom + "B").GetComponent <Transform> ().localScale = Vector3.one;
                            MostrarPanel(true);
                            txtAviso.text = "Lo lograste, ahora avanza al siguiente objetivo";
                            txtAviso.text = txtAviso.text + " " + txtTarget.text;
                            inf.QuitarElemento(nom);
                            target = inf.getNextItem();
                            if (!target.Contains("Cil") && !quitadas)
                            {
                                quitadas = true;
                                DestruirCilindros();
                            }
                            txtTarget.text = inf.getNextItemCorte();
                            Debug.Log("Cambiaremos de Objetivo a " + target);
                            CambiarImg("nada");
                            imgObjetivo.GetComponent <RectTransform> ().localScale = Vector3.zero;
                            CambiarImgObj();
                            consecutivas = 0;
                            final++;
                            MostrarFigurasObj();
                            PausarJuego();
                        }
                    }
                    else
                    {
                        puntos -= 100;
                        errores = Convert.ToInt32(GameObject.Find("txtErrores").GetComponent <Text>().text);
                        errores++;
                        GameObject.Find("txtErrores").GetComponent <Text>().text = errores.ToString();

                        consecutivas = 0;
                        MostrarPanel(false);
                        txtAviso      = GameObject.Find("txtAviso").GetComponent <Text> ();
                        txtAviso.text = "Incorrecto, se te pide que encuentres los fragmentos para armar la figura ";
                        txtAviso.text = txtAviso.text + " " + inf.getNextItemFigura();                         // + " " + txtTarget.text;
                        Debug.Log("A:  " + nom + "A" + ", " + nom + "B");
                        PausarJuego();
                        VerAyuda(txtTarget.text, target);
                    }

                    if (final > 5)
                    {
                        int aciertos = Convert.ToInt32(GameObject.Find("txtAciertos").GetComponent <Text>().text);
                        int err      = Convert.ToInt32(GameObject.Find("txtErrores").GetComponent <Text>().text);
                        Debug.Log("Errores " + err);
                        GuardarDatos g = new GuardarDatos("3", aciertos, err, puntos, tiempo, 1, "Facil");
                        g.Insert();
                        txtTarget.text = "FIN DEL JUEGO";
                        Debug.Log("Fin del juego");
                        GameObject  [] gmeO = GameObject.FindGameObjectsWithTag("Mov1");
                        foreach (GameObject gme in gmeO)
                        {
                            Destroy(gme, 0);
                        }
                    }
                    GameObject.Find("txtPuntos").GetComponent <Text> ().text       = puntos.ToString();
                    GameObject.Find("txtConsecutivas").GetComponent <Text> ().text = consecutivas.ToString();
                }
            }
        }
    }