Example #1
0
    IEnumerator animacionSalir()
    {
        animatorMenuPpal.SetTrigger("exit");

        yield return(new WaitForSeconds(0.6f));

        StartCoroutine(CameraAnimations.animacionSalirMenuCrear(escena));
        yield return(new WaitForSeconds(2f));

        LevelLoader LevelL = GameObject.FindGameObjectWithTag("LevelLoader").GetComponent <LevelLoader>();

        LevelL.loadLevel(escena);
        // SceneManager.LoadScene(escena, LoadSceneMode.Single);
    }
Example #2
0
    public void nuevaViaLactea()
    {
        //TMP_InputField totalNebulosas=canvasMenuCrear.transform.Find("Canvas/Nebulosas/Total").GetComponent<TMP_InputField>();
        //TMP_InputField totalSistemasPlanetarios=canvasMenuCrear.transform.Find("Canvas/SistemasPlanetarios/Total").GetComponent<TMP_InputField>();
        //TMP_InputField totalSistemasPlanetas= canvasMenuCrear.transform.Find("Canvas/Planetas/Total").GetComponent<TMP_InputField>();

        Slider maxNebulosas           = canvasMenuCrear.transform.Find("Canvas/Nebulosas/Slider").GetComponent <Slider>();
        Slider maxSistemasPlanetarios = canvasMenuCrear.transform.Find("Canvas/SistemasPlanetarios/Slider").GetComponent <Slider>();
        Slider maxPlanetas            = canvasMenuCrear.transform.Find("Canvas/Planetas/Slider").GetComponent <Slider>();

        Toggle         random          = canvasMenuCrear.transform.Find("Canvas/Info/Toggle").GetComponent <Toggle>();
        TMP_InputField nombreViaLactea = canvasMenuCrear.transform.Find("Canvas/Info/Nombre").GetComponent <TMP_InputField>();


        ViaLactea viaLactea = new ViaLactea();

        viaLactea.nombre    = nombreViaLactea.text;
        viaLactea.Nebulosas = new List <Nebulosa>();



        if (random.isOn)
        {
            int nebulosas = Random.Range((int)maxNebulosas.minValue, (int)maxNebulosas.value);
            for (int i = 0; i < nebulosas; i++)
            {
                Nebulosa nebulosaTemp = crearNebulosa();
                viaLactea.Nebulosas.Add(nebulosaTemp);
                int sistemas = Random.Range((int)maxSistemasPlanetarios.minValue, (int)maxSistemasPlanetarios.value);
                for (int j = 0; j < sistemas; j++)
                {
                    SistemaPlanetario sistemaTemp = crearsistemaPlanetario();
                    viaLactea.Nebulosas[i].sistemasPlanetarios.Add(sistemaTemp);
                    for (int k = 0; k < (int)maxPlanetas.value; k++)
                    {
                        Planeta planeta = crearPlaneta();
                        viaLactea.Nebulosas[i].sistemasPlanetarios[j].nodos.Add(planeta);
                    }
                }
            }
        }
        else
        {
            for (int i = 0; i < (int)maxNebulosas.value; i++)
            {
                Nebulosa nebulosa = crearNebulosa();
                viaLactea.Nebulosas.Add(nebulosa);
                for (int j = 0; j < (int)maxSistemasPlanetarios.value; j++)
                {
                    SistemaPlanetario sistema = crearsistemaPlanetario();
                    viaLactea.Nebulosas[i].sistemasPlanetarios.Add(sistema);

                    for (int k = 0; k < (int)maxPlanetas.value; k++)
                    {
                        Planeta planeta = crearPlaneta();
                        viaLactea.Nebulosas[i].sistemasPlanetarios[j].nodos.Add(planeta);
                    }
                }
            }
        }


        viaLactea = ViaLacteaService.PostViaLactea(viaLactea);
        CargarViaLactea cargar = GameObject.FindGameObjectWithTag("ViaLactea").GetComponent <CargarViaLactea>();

        cargar.setViaLactea(viaLactea);

        StartCoroutine(CameraAnimations.animacionSalirMenuCrear("Editor"));

        StartCoroutine(irAEditor());
    }