Example #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        GameObject col = other.gameObject;

        if (col.CompareTag("escada"))
        {
            escada esc = other.GetComponent <escada>();
            if (esc.final == true)
            {
                if (pulando == true)
                {
                    paradoescada = true;
                    parado       = false;
                }
                else
                {
                    parado       = true;
                    paradoescada = false;
                }
                subir   = true;
                subindo = false;

                v = personagem.velocity;
                personagem.gravityScale = 0;
                v.y = 0f;
                personagem.velocity = v;
            }
        }
        if (col.CompareTag("fundo_falso"))
        {
            bool oddeven = Mathf.FloorToInt(Time.time) % 2 == 0;
            rend = col.GetComponent <SpriteRenderer>();
            // Enable renderer accordingly
            rend.enabled = false;
        }
    }
Example #2
0
        private static void snakesAndLeaders(String[] args)
        {
            StringBuilder vs_JogadaDado = new StringBuilder();
            System.IO.TextReader reader = Console.In;
            int qtdTestes = Convert.ToInt32(reader.ReadLine());
            int qtdCobras = 0; int qtdEscadas = 0; escada vo_Escada; string linha = "";
            List<escada> lst_escadas = new List<escada>();

            for (int i = 0; i < qtdTestes; i++)
            {
                qtdCobras = Convert.ToInt32(reader.ReadLine());
                for (int j = 0; j < qtdCobras; j++)
                {
                    linha = reader.ReadLine();
                    vo_Escada = new escada(Convert.ToInt32(linha.Split(' ')[0]),
                                           Convert.ToInt32(linha.Split(' ')[1]),
                                      false);
                    lst_escadas.Add(vo_Escada);
                }
                qtdEscadas = Convert.ToInt32(reader.ReadLine());
                for (int j = 0; j < qtdEscadas; j++)
                {
                    linha = reader.ReadLine();
                    vo_Escada = new escada(Convert.ToInt32(linha.Split(' ')[0]),
                                           Convert.ToInt32(linha.Split(' ')[1]),
                                      false);
                    lst_escadas.Add(vo_Escada);
                }
                vs_JogadaDado.Append(calculaQuantidadeMinimaLancamentos(101, lst_escadas) + "\n");
                lst_escadas.Clear();
            }
            Console.Write(vs_JogadaDado.ToString());
    }