Exemplo n.º 1
0
    private void AddVetaToMision(Veta veta)
    {
        IList <MetaRecurso> metasRecurso = Mision.Metas
                                           .Select(m => m as MetaRecurso)
                                           .Where(m => m.Recurso == veta.Recurso)
                                           .ToList();

        foreach (var metaRecurso in metasRecurso)
        {
            metaRecurso.MasaActual += veta.Masa;
        }
    }
Exemplo n.º 2
0
    public void OnCollisionEnter(Collision collision)
    {
        Debug.Log(String.Format("collision.gameObject.tag: {0} gameObject.tag: {1}", collision.gameObject.tag, gameObject.tag));

        //bool destroy = false;

        //if (collision.gameObject ) {
        Veta veta = collision.gameObject.GetComponent <Veta>();

        //VetaHierroBehaviour behaviourH = collision.gameObject.GetComponent<VetaHierroBehaviour>();
        if (veta != null)
        {
            AddVetaToMochila(veta);
            AddVetaToMision(veta);

            Medidor medidor = mochila.Single(m => m.Recurso == veta.Recurso);

            if (veta is VetaHierroBehaviour)
            {
                textHierro.text = String.Format("{0} Kgs", medidor.MasaActual.ToString());
            }
            else if (veta is VetaAguaBehaviour)
            {
                textAgua.text = String.Format("{0} Lts", medidor.MasaActual.ToString());
            }
            else if (veta is VetaSilicioBehaviour)
            {
                textSilicio.text = String.Format("{0} Kgs", medidor.MasaActual.ToString());
            }
            else if (veta is VetaCalcioBehaviour)
            {
                textCalcio.text = String.Format("{0} Kgs", medidor.MasaActual.ToString());
            }
            else if (veta is VetaMagnesioBehaviour)
            {
                textMagnesio.text = String.Format("{0} Kgs", medidor.MasaActual.ToString());
            }

            Debug.Log(String.Format("Se agregaron {0} Kg de hierro a la mochila! Hierro en la mochila: {1}/{2} Kg",
                                    veta.Masa.ToString(),
                                    medidor.MasaActual.ToString(),
                                    medidor.MasaMaxima.ToString()));

            Destroy(collision.gameObject);
        }

        if (Mision.EstaCumplida)
        {
            Debug.Log("Mision cumplida!");
        }
    }
Exemplo n.º 3
0
        public string Morseovka()
        {
            string text = Veta.Trim().ToLower();

            text = text.Replace("á", "a");
            text = text.Replace("é", "e");
            text = text.Replace("í", "i");
            text = text.Replace("ó", "o");
            text = text.Replace("ú", "u");
            text = text.Replace("ů", "u");
            text = text.Replace("ý", "y");
            text = text.Replace("ž", "z");
            text = text.Replace("š", "s");
            text = text.Replace("č", "c");
            text = text.Replace("ř", "r");
            text = text.Replace("ď", "d");
            text = text.Replace("ť", "t");
            text = text.Replace("ň", "n");

            string sifra = "";

            string abecedniZnaky = "abcdefghijklmnopqrstuvwxyz";

            string[] morseovyZnaky = { ".-",   "-...", "-.-.", "-..",
                                       ".",    "..-.", "--.",  "....","..",    ".---", "-.-",
                                       ".-..", "--",   "-.",   "---", ".--.",  "--.-", ".-.",
                                       "...",  "-",    "..-",  "...-",".--",   "-..-", "-.--", "--.." };

            foreach (var item in text)
            {
                int pozice = abecedniZnaky.IndexOf(item);
                if (pozice >= 0)
                {
                    sifra += morseovyZnaky[pozice] + " | ";
                }
            }
            return(sifra);
        }
Exemplo n.º 4
0
    private void AddVetaToMochila(Veta veta)
    {
        Medidor medidorHierro = mochila.SingleOrDefault(m => m.Recurso == veta.Recurso);

        if (medidorHierro == null)
        {
            medidorHierro = new Medidor()
            {
                MasaMaxima = 100, MasaActual = veta.Masa, Recurso = veta.Recurso
            };

            mochila.Add(medidorHierro);
        }
        else
        {
            medidorHierro.MasaActual += veta.Masa;

            if (medidorHierro.MasaActual > medidorHierro.MasaMaxima)
            {
                medidorHierro.MasaActual = medidorHierro.MasaMaxima;
            }
        }
    }
Exemplo n.º 5
0
        public string[] Analyzuj()
        {
            //tahle metoda by šla určitě udělat nějak líp...

            int    samohlC = 0, samohlDlC = 0, souhlC = 0, souhlTvrC = 0, souhlMekC = 0, pismC = 0, cislC = 0, zavorC = 0, specZnC = 0;
            string samohlT = "", samohlDlT = "", souhlT = "", souhlTvrT = "", souhlMekT = "", pismT = "", cislT = "", zavorT = "", specZnT = "";

            string samohlasky       = "aeiouy";
            string samohlaskyDlouhe = "áéíóúůý";
            string souhlasky        = "bflmpsvz";
            string souhlaskyTvrd    = "hkrdtn";
            string souhlaskyMekke   = "žščřcjďťň";
            string pismena          = "gqwx";
            string cisla            = "1234567890";
            string zavorky          = "<>[]{}()";
            string specZnak         = $"\\/|€$ߤŁđĐł#&@*“\'\"‘;,:";

            foreach (char znak in Veta.ToLower())
            {
                if (samohlasky.Contains(znak))
                {
                    samohlC++;
                    samohlT += znak + " ";
                }
                if (samohlaskyDlouhe.Contains(znak))
                {
                    samohlDlC++;
                    samohlDlT += znak + " ";
                }
                if (souhlasky.Contains(znak))
                {
                    souhlC++;
                    souhlT += znak + " ";
                }
                if (souhlaskyTvrd.Contains(znak))
                {
                    souhlTvrC++;
                    souhlTvrT += znak + " ";
                }
                if (souhlaskyMekke.Contains(znak))
                {
                    souhlMekC++;
                    souhlMekT += znak + " ";
                }
                if (pismena.Contains(znak))
                {
                    pismC++;
                    pismT += znak + " ";
                }
                if (cisla.Contains(znak))
                {
                    cislC++;
                    cislT += znak + " ";
                }
                if (zavorky.Contains(znak))
                {
                    zavorC++;
                    zavorT += znak + " ";
                }
                if (specZnak.Contains(znak))
                {
                    specZnC++;
                    specZnT += znak + " ";
                }
            }
            string[] vysledky = { $"Celkem: {samohlC}; {samohlT}",     $"Celkem: {samohlDlC}; {samohlDlT}", $"Celkem: {souhlC}; {souhlT}",
                                  $"Celkem: {souhlTvrC}; {souhlTvrT}", $"Celkem: {souhlMekC}; {souhlMekT}", $"Celkem: {pismC}; { pismT}",
                                  $"Celkem: {cislC}; {cislT}",         $"Celkem: {zavorC}; {zavorT}",       $"Celkem: {specZnC}; {specZnT}" };

            return(vysledky);
        }
    private void AddVetaToMochila(Veta veta)
    {
        Medidor medidorHierro = mochila.SingleOrDefault (m => m.Recurso == veta.Recurso);

        if (medidorHierro == null) {

            medidorHierro = new Medidor() { MasaMaxima = 100, MasaActual = veta.Masa, Recurso = veta.Recurso };

            mochila.Add(medidorHierro);

        }
        else {

            medidorHierro.MasaActual += veta.Masa;

            if (medidorHierro.MasaActual > medidorHierro.MasaMaxima) {

                medidorHierro.MasaActual = medidorHierro.MasaMaxima;

            }

        }
    }
    private void AddVetaToMision(Veta veta)
    {
        IList<MetaRecurso> metasRecurso = Mision.Metas
                                                    .Select (m => m as MetaRecurso)
                                                    .Where (m => m.Recurso == veta.Recurso)
                                                    .ToList ();

        foreach (var metaRecurso in metasRecurso) {

            metaRecurso.MasaActual += veta.Masa;

        }
    }