Ejemplo n.º 1
0
        public Barco(Point ponto1, int tamanho, List <Image> imagens, Horientacao horientacao)
        {
            partesBarco = new Dictionary <Point, Image>();
            Ponto1      = ponto1;
            Tamanho     = tamanho;

            switch (horientacao)
            {
            case Horientacao.VERTICAL:
                for (int indice = 0; indice < imagens.Count; indice++)
                {
                    partesBarco.Add(new Point {
                        X = ponto1.X + indice, Y = ponto1.Y
                    }, imagens.ElementAt(indice));
                }

                break;

            case Horientacao.HORIZONTAL:
                for (int indice = 0; indice < imagens.Count; indice++)
                {
                    partesBarco.Add(new Point {
                        X = ponto1.X, Y = ponto1.Y + indice
                    }, imagens.ElementAt(indice));
                }
                break;

            default:
                break;
            }
            Image       = imagens;
            Horientacao = horientacao;
        }
Ejemplo n.º 2
0
        private Barco criarBarcoRandomico(int tamanho, List <Image> imagem)
        {
            int         x1          = random.Next(10);
            int         y1          = random.Next(10);
            Point       origin      = new Point(x1, y1);
            Horientacao horientacao = randomHorientacao();

            return(new Barco(origin, tamanho, imagem, horientacao));
        }