Example #1
0
    public void OnTriggerEnter2D(Collider2D cTrigger)
    {
        gameData        = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/Gamedata.json"));;
        tomoRegaloCarta = "" + gameData[4];
        GameObject camara = GameObject.Find("Main Camera");
        GameObject fondo  = GameObject.Find("Background");

        camara.GetComponent <JSONWriter>().reescribirJSON(fondo.GetComponent <TimeDayFunction>().dia, new int[] { int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento1.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento2.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento3.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento4.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento5.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento6.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento7.text), int.Parse(camara.GetComponent <JSONLoaderJuego0>().cantidadAlimento8.text) }, (int)camara.GetComponent <EnergyBar>().Energy, fondo.GetComponent <TimeDayFunction>().hora, tomoRegaloCarta, fondo.GetComponent <TimeDayFunction>().inicio, fondo.GetComponent <TimeDayFunction>().ultimoSegundo, fondo.GetComponent <TimeDayFunction>().segundoActual, new string[] { "Arroz", "Huevos", "Agua", "Arroz con leche", "Chocolate", "Dulces", "Granos", "Pan de centeno" });

        if (cTrigger.tag != "Player")
        {
            return;
        }

        if (fondo.GetComponent <TimeDayFunction>().dia == 4 && ((levelToLoad.Equals("Sala") && SceneManager.GetActiveScene().name.Equals("Calle")) || levelToLoad.Equals("Colegio") || levelToLoad.Equals("Coorporacion")))
        {
            SceneManager.LoadScene("Fin");
        }
        else
        {
            if (fondo.GetComponent <TimeDayFunction>().hora > 17 && levelToLoad.Equals("Colegio"))
            {
                jsonLoader.darInformacion("El colegio se encuentra cerrado.");
            }
            else
            {
                sceneController.LoadScene(levelToLoad);
            }
        }
    }
Example #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        //PARA DORMIR
        GameObject fondo = GameObject.Find("Background");

        if (col.name == "cama" && fondo.GetComponent <TimeDayFunction>().hora < 19)
        {
            jsonLoader.darInformacion("NO TENGO GANAS DE DORMIR");
        }
        else if (col.name == "PuntoDiscurso")
        {
            if (panelOpcionesDiscurso != null)
            {
                panelOpcionesDiscurso.SetActive(true);
                botonCarta.SetActive(false);
                botonPeriodico.SetActive(false);
                botonRegalo.SetActive(false);
            }
        }
        else if (col.name == "HablarCalvo")
        {
            hablarNPC1();
        }
        else if (col.name == "HablarNina")
        {
            hablarNPC2();
        }
        //PARA HABLAR
        else if (panelOpcionesHablar != null && col.name == "mama")
        {
            hablarMom();
        }
        if (col.name == "GameObject")
        {
            SoundManager.PlaySound("patearBalon");
        }
    }
    void OnTriggerEnter2D(Collider2D col)
    {
        GameObject fondo = GameObject.Find("Background");

        if (col.name == "cama" && fondo.GetComponent <TimeDayFunction>().hora < 19)
        {
            jsonLoader.darInformacion("NO TENGO GANAS DE DORMIR");
        }
        else if (col.name == "PuntoDiscurso")
        {
            MostrarBotonAnimacion("puntoDiscurso", true);
            botonCarta.SetActive(false);
            botonPeriodico.SetActive(false);
            botonRegalo.SetActive(false);
        }
        else if (col.tag == "npc")
        {
            hablarNPC(col.name);
        }
        if (col.tag == "interactivo")
        {
            soundManager.PlaySound(col.name);
        }
    }