Exemplo n.º 1
0
    public void ActualizarDatosReactivo(MaterialReactivo reactivo, float tiempo)
    {
        TextoTiempoReaccion.transform.parent.gameObject.SetActive(true);
        TextoAzufreRestante.transform.parent.gameObject.SetActive(true);
        TextoCantidadAcidoRestante.transform.parent.gameObject.SetActive(true);
        TextoTiempoReaccion.text = FormatearTiempo(tiempo);

        ReactivoAcidoClorhidrico acido = (ReactivoAcidoClorhidrico)reactivo;

        float acidoRestante  = acido.CalcularAcidoRestante(tiempo);
        float azufreRestante = acido.CalcularAzufreRestante(tiempo);

        string acidoFormateado  = MaterialReactivo.FormatearCantidad(acidoRestante, MaterialReactivo.UnidadMedida.ml);
        string azufreFormateado = MaterialReactivo.FormatearCantidad(azufreRestante, MaterialReactivo.UnidadMedida.gr);

        TextoCantidadAcidoRestante.text = acidoFormateado;
        TextoAzufreRestante.text        = azufreFormateado;
    }
Exemplo n.º 2
0
    void Awake()
    {
        GameObject ui = GameObject.FindGameObjectWithTag("UIPanelMaterial");

        if (ui != null)
        {
            uiPanelMaterial = ui.GetComponent <UIPanelMaterial>();
            ui.SetActive(false);
        }


        ui = GameObject.FindGameObjectWithTag("UIExperimentos");
        if (ui != null)
        {
            uiExperimentos = ui.GetComponent <UIExperimentos>();
            ui.SetActive(true);
        }


        EstadoSeleccion = EnumSeleccion.Nada;

        // Materiales normales
        objetos = new List <GameObject>();
        GameObject [] materiales = GameObject.FindGameObjectsWithTag("Material");
        for (int i = 0; i < materiales.Length; i++)
        {
            objetos.Add(materiales[i]);
        }

        // Materiales Reactivos
        GameObject[] rs = GameObject.FindGameObjectsWithTag("MaterialReactivo");
        Reactivos = new List <MaterialReactivo>();
        for (int i = 0; i < rs.Length; i++)
        {
            MaterialReactivo m = rs[i].GetComponent <MaterialReactivo>();
            Reactivos.Add(m);

            ReactivoAcidoClorhidrico ac = m as ReactivoAcidoClorhidrico;
            if (ac != null)
            {
                acido = ac;
            }
        }
    }