Exemple #1
0
    public void irANebulosa()
    {
        NebulosaSingleton ns = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();

        ns.nebulosa = nebulosa;
        StartCoroutine(animacionIrANebulosa(new Vector3(nebulosa.x, nebulosa.y, nebulosa.z)));
    }
Exemple #2
0
    private bool eliminar = false; // esta variable inicia en false por que el toggle también comienza en false es importante no cambiar valor por defecto del toogleEliminar


    void Start()
    {
        StartCoroutine(desctivarCanvas());
        NebulosaSingleton ns = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();

        nombreNebulosa.text = ns.nebulosa.nombre;
        Peligrosa.enabled   = ns.nebulosa.danger;
        ns.cargar(false);
    }
Exemple #3
0
    /// <summary>
    /// Actualiza la información del sistema planetario con los datos de la escena
    /// Este metodo es utilizado en la escena editor nebulosa
    /// </summary>
    public void actualizarDatos()
    {
        sistemaPlanetario.x = transform.position.x;
        sistemaPlanetario.y = transform.position.y;
        sistemaPlanetario.z = transform.position.z;

        NebulosaSingleton cargar = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();

        sistemaPlanetario.nebulosaFK = cargar.nebulosa.id;
    }
Exemple #4
0
    void Start()
    {
        nave = GameObject.FindGameObjectWithTag("Nave").GetComponent <NaveEspacial>();
        nebulosaSingleton = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();

        foreach (var item in nebulosaSingleton.nebulosa.sistemasPlanetarios)
        {
            item.recorrido = new RecorridoPlanetas();
            item.recorrido.buscarNodoInicial(item.nodos, item.grafo);
        }
        nebulosaSingleton.nebulosa.recorrido = new RecorridoSistemas();
        nebulosaSingleton.nebulosa.recorrido.iniciarAlgoritmo(nebulosaSingleton.nebulosa);


        GameObject lineaSistemas = Instantiate(lineaRecorrido);


        #region pintarLineas
        int i = 0;
        if (nebulosaSingleton.nebulosa.recorrido.caminoGlobal != null)
        {
            foreach (var item in nebulosaSingleton.nebulosa.recorrido.caminoGlobal)
            {
                lineaSistemas.GetComponent <LineRenderer>().positionCount = i + 1;


                lineaSistemas.GetComponent <LineRenderer>().SetPosition(i, new Vector3(item.x, 0, item.z));
                i++;
                GameObject lineaPlanetas = Instantiate(lineaRecorrido);

                GameObject circulo = new GameObject();
                circulo.transform.position   = new Vector3(item.x, 0, item.z);
                circulo.transform.localScale = new Vector3(20, 20, 20);
                GameObject sistemaTemp = new GameObject();
                sistemaTemp.transform.parent        = circulo.transform;
                sistemaTemp.transform.localPosition = new Vector3(0, -2, 0);
                sistemaTemp.transform.localScale    = new Vector3(0.5f, 0.5f, 0.5f);
                GameObject planetaTemp = new GameObject();
                int        j           = 0;
                lineaPlanetas.GetComponent <LineRenderer>().startWidth = 0.5f;
                foreach (var planeta in item.recorrido.caminoGlobal)
                {
                    planetaTemp.transform.parent        = sistemaTemp.transform;
                    planetaTemp.transform.localPosition = (new Vector3(planeta.x, 0, planeta.z));
                    lineaPlanetas.GetComponent <LineRenderer>().positionCount = j + 1;
                    lineaPlanetas.GetComponent <LineRenderer>().SetPosition(j, new Vector3(planetaTemp.transform.position.x, -40, planetaTemp.transform.position.z));
                    j++;
                }
            }
        }
        #endregion pintarLineas

        StartCoroutine(nave.sistemaDeNavegacion(nebulosaSingleton.nebulosa.recorrido.caminoGlobal));
    }
Exemple #5
0
 void Awake()
 {
     if (nebulosaSingleton == null)
     {
         nebulosaSingleton = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (nebulosaSingleton != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #6
0
    private void Start()
    {
        combustibleSlider = GameObject.Find("Combustible").GetComponent <Slider>();
        combustibleText   = GameObject.Find("Combustible/Cantidad").GetComponent <TextMeshProUGUI>();

        sondas = GameObject.Find("Sondas").GetComponent <TextMeshProUGUI>();

        iridioFill       = GameObject.Find("Iridio/FillingObject").GetComponent <Image>();
        paladioFill      = GameObject.Find("Paladio/FillingObject").GetComponent <Image>();
        platinoFill      = GameObject.Find("Platino/FillingObject").GetComponent <Image>();
        elementoZeroFill = GameObject.Find("ElementoZero/FillingObject").GetComponent <Image>();

        iridioText       = GameObject.Find("Iridio/Cantidad").GetComponent <TextMeshProUGUI>();
        paladioText      = GameObject.Find("Paladio/Cantidad").GetComponent <TextMeshProUGUI>();
        platinoText      = GameObject.Find("Platino/Cantidad").GetComponent <TextMeshProUGUI>();
        elementoZeroText = GameObject.Find("ElementoZero/Cantidad").GetComponent <TextMeshProUGUI>();

        PanelPlaneta        = GameObject.Find("MaterialesPlaneta").gameObject;
        iridioPlaneta       = GameObject.Find("MaterialesPlaneta/Iridio").GetComponent <TextMeshProUGUI>();
        paladioPlaneta      = GameObject.Find("MaterialesPlaneta/Paladio").GetComponent <TextMeshProUGUI>();
        platinoPlaneta      = GameObject.Find("MaterialesPlaneta/Platino").GetComponent <TextMeshProUGUI>();
        ElementoZeroPlaneta = GameObject.Find("MaterialesPlaneta/ElementoZero").GetComponent <TextMeshProUGUI>();
        nombrePlaneta       = GameObject.Find("MaterialesPlaneta/Nombre").GetComponent <TextMeshProUGUI>();

        vida = GameObject.Find("Vida").GetComponent <TextMeshProUGUI>();
        dano = GameObject.Find("Dano").GetComponent <TextMeshProUGUI>();

        //botonAtacar = GameObject.Find("Atacar").gameObject;

        nebulosa = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();
        botonAtacar.GetComponent <Button>().onClick.AddListener(AbrirCanvas);
        botonAtacar.SetActive(nave.inPlaneta);


        btnMejoraEM = GameObject.Find("Mejoras/EM").GetComponent <Button>();
        btnMejoraBL = GameObject.Find("Mejoras/BL").GetComponent <Button>();
        btnMejoraPO = GameObject.Find("Mejoras/PO").GetComponent <Button>();
        btnMejoraCP = GameObject.Find("Mejoras/CP").GetComponent <Button>();
        btnMejoraCD = GameObject.Find("Mejoras/CD").GetComponent <Button>();
        btnMejoraVI = GameObject.Find("Mejoras/VI").GetComponent <Button>();
        btnMejoraCC = GameObject.Find("Mejoras/CC").GetComponent <Button>();
        btnMejoraCT = GameObject.Find("Mejoras/CT").GetComponent <Button>();

        EM            = btnMejoraEM.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        BL            = btnMejoraBL.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        PO            = btnMejoraPO.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        CP            = btnMejoraCP.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        CD            = btnMejoraCD.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        VI            = btnMejoraVI.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        CC            = btnMejoraCC.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        CT            = btnMejoraCT.transform.Find("Cantidad").GetComponent <TextMeshProUGUI>();
        finSimulacion = transform.Find("Terminada").GetComponent <TextMeshProUGUI>();
    }
Exemple #7
0
    void Start()
    {
        cargar = GameObject.FindGameObjectWithTag("ViaLactea").GetComponent <CargarViaLactea>();


        foreach (var item in cargar.viaLactea.Nebulosas)
        {
        }

        foreach (var item in cargar.viaLactea.Nebulosas)
        {
            if (!item.visitado)
            {
                item.visitado = true;
                NebulosaSingleton ns = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();
                ns.nebulosa = item;

                foreach (var sistemas in item.sistemasPlanetarios)
                {
                    foreach (var planeta in sistemas.nodos)
                    {
                        if (planeta.teletransportador.planetaFK != 0)
                        {
                            item.tieneTeletransportador = true;
                        }
                        if (planeta.inicial)
                        {
                            item.inicial     = true;
                            sistemas.inicial = true;
                        }
                    }
                }

                if (item.tieneTeletransportador && item.inicial)
                {
                    foreach (var itemtemp in cargar.viaLactea.Nebulosas)
                    {
                        itemtemp.inicial = true;
                    }
                    StartCoroutine(animacionIrANebulosa(new Vector3(item.x, item.y, item.z)));
                    break;
                }
            }
            if (item == cargar.viaLactea.Nebulosas[cargar.viaLactea.Nebulosas.Count - 1])
            {
                NaveEspacial.naveEspacial.finSimulacion = true;
            }
        }


        //volver a tierra
    }
Exemple #8
0
    void Start()
    {
        StartCoroutine(desctivarCanvas());

        nave = GameObject.FindGameObjectWithTag("Nave");
        nave.GetComponent <NaveEspacial>().enabled = true;
        nave.GetComponent <CamaraNave>().enabled   = true;


        NebulosaSingleton ns = GameObject.FindGameObjectWithTag("Nebulosa").GetComponent <NebulosaSingleton>();

        nombreNebulosa.text = ns.nebulosa.nombre;
        Peligrosa.enabled   = ns.nebulosa.danger;
        ns.cargar(true);
    }