Exemple #1
0
 public Point GetNextPoint()
 {
     Point head = this.plist.Last();
     Point next = new Point(head);
     next.Move(1, this.direction);
     return next;
 }
Exemple #2
0
 public Point getNextPoint()
 {
     Point head = pList.Last();
     Point nextPoint = new Point(head);
     nextPoint.Move(1 , direction);
     return nextPoint;
 }
Exemple #3
0
        public Point GetNextPoint()
        {
            Point head      = pList.Last();
            Point nextPoint = new Point(head);

            nextPoint.Move(1, direction);
            return(nextPoint);
        }
Exemple #4
0
 public Snake(Point tail, int lenght, Direction direction)
 {
     for (int i = 0; i < lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #5
0
        private Point GetNextPoint()
        {
            Point head      = _points.Last();
            Point nextPoint = new Point(head);

            nextPoint.Move(1, _direction);

            return(nextPoint);
        }
Exemple #6
0
        private Point GetNextPoint()
        {
            Point pLast = pLine.Last();
            Point pNext = new Point(pLast);

            pNext.Move(1, direction);

            return(pNext);
        }
Exemple #7
0
        private Point GetNextPoint()
        {
            //Console.WriteLine(pList.Capacity-2);
            Point head      = pList[pList.Count - 1];
            Point nextPoint = new Point(head);

            nextPoint.Move(1, direction);
            return(nextPoint);
        }
Exemple #8
0
 public Snake(Point tail, int length, Direction direction)
 {
     pList = new List<Point>();
     for(int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #9
0
 public Snake(Point tail, int length, Direction direction)
 {
     this.direction = direction;
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
 /// <summary>
 ///     Конструктор
 /// </summary>
 /// <param name="tail">Позиция хвоста змейки</param>
 /// <param name="length">Длина змейки</param>
 /// <param name="direction">Направление перемещения змейки</param>
 public Snake(Point tail, int length, Direction direction)
 {
     Direction = direction;
     for (var i = 0; i <= length; i++)
     {
         var point = new Point(tail);
         point.Move(i, direction);
         LinePoints.Add(point);
     }
 }
Exemple #11
0
 public Snake(Point tail, int length, Direction direction)
 {
     pList = new List<Point>();
     for(int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #12
0
 public Snake(Point tail, int length, Dir _dir)
 {
     dir   = _dir;
     pList = new List <Point>();
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, dir);
         pList.Add(p);
     }
 }
Exemple #13
0
 public Snake(Point tall, int length, Direction _direction)
 {
     direction = _direction;
     vList     = new List <Point>();
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tall);
         p.Move(i, direction);
         vList.Add(p);
     }
 }
Exemple #14
0
 public void Move()
 {
     Point tail = pList.First();
     Point head = pList.Last();
     Point NextPoint = new Point(head);
     tail.Clear();
     pList.Remove(tail);
     NextPoint.Move(1, direction);
     NextPoint.Draw();
     pList.Add(NextPoint);
 }
Exemple #15
0
 public Snake(Point tail, int length, Direction dir)
 {
     pline     = new List <Point>();
     direction = dir;
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, dir);
         pline.Add(p);
     }
 }
Exemple #16
0
 public Snake(Point tail, int Lenght, direction _Direction)
 {
     Direction = _Direction;
     pList     = new List <Point>();
     for (int i = 0; i < Lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, Direction);
         pList.Add(p);
     }
 }
Exemple #17
0
 public Snake(Point tail, int lenght, Direction direction)
 {
     plist          = new List <Point>();
     this.direction = direction;
     for (int i = 0; i < lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         plist.Add(p);
     }
 }
Exemple #18
0
 public Snake(Point tail, int lenght, Direction _direction)
 {
     direction = _direction;
     pList     = new List <Point>();//create list
     for (int i = 0; i <= lenght; i++)
     {
         Point p = new Point(tail); //copy point of tail
         p.Move(i, direction);      // move to direction on i value
         pList.Add(p);              // add point to list
     }
 }
Exemple #19
0
 public Snake(Point tail, int length, Direction _direction)
 {
     direction = _direction;
     plist     = new List <Point>();
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail); // создаются точки, являющиися точной копией хвостовой точки
         p.Move(i, direction);      // сдвигается на i позиций по направлению дирекции и добавить точку в список
         plist.Add(p);
     }
 }
Exemple #20
0
 public Snake(Point tail, int length, Direction _direction)
 {
     direction = _direction;
     pList     = new List <Point>();
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail, ConsoleColor.Red);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #21
0
 public Snake(Point tail, int length, Direction direction)
 {
     _direction = direction;
     pointList  = new List <Point>();
     for (int i = 0; i < length; i++)
     {
         Point point = new Point(tail);
         point.Move(i, direction);
         pointList.Add(point);
     }
 }
Exemple #22
0
 public Snake(Point tail, int length, Direction _direction)
 {
    points = new List<Point>();
    direction = _direction;
    for(int _x = 0; _x < length; _x++)
     {
         Point p = new Point(tail);
         p.Move(_x, direction);
         points.Add(p);
     }
 }
Exemple #23
0
 /// Методы ///
 /* Функция построения змейки */
 public Snake(Point tail, int lenght, Direction _direction)
 {
     direction = _direction;           // Переменная направления движения
     pList     = new List <Point>();   // Создаем List точек
     for (int i = 0; i < lenght; i++)  // Создаем список точек из которых состоит змейка
     {
         Point p = new Point(tail);    // Новая точка
         p.Move(i, direction);         // Сдвигаем точку
         pList.Add(p);                 // Добавляем точку
     }
 }
Exemple #24
0
 public Snake(Point tail, int lenght, Direction _direction)
 {
     direction = _direction;
     pointList = new List <Point>();
     for (int i = 0; i < lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pointList.Add(p);
     }
 }
Exemple #25
0
 public Snake(Point t, int l, Direction _d)
 {
     d      = _d;
     points = new List <Point>();
     for (int i = 0; i < l; ++i)
     {
         Point p = new Point(t);
         p.Move(i, d);
         points.Add(p);
     }
 }
Exemple #26
0
 public Snake(Point tail,int Lenth,Direction _direct)
 {
     direct = _direct;
     pList = new List<Point>();
     for (int i = 0; i < Lenth; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direct);
         pList.Add(p);
     }
 }
Exemple #27
0
        public Point GetNewPoint()
        {
            Point LastPoint = dots.Last();
            Point NextPoint = new Point(LastPoint);

            NextPoint.Move(1, direction);



            return(NextPoint);
        }
Exemple #28
0
 public Snake(Point tail, int length, Direction _direction)
 {
     direction = _direction;
     pointList = new List <Point>();
     for (int tick = 0; tick < length; tick++)
     {
         Point point = new Point(tail);
         point.Move(tick, direction);
         pointList.Add(point);
     }
 }
Exemple #29
0
 public Snake(Point tail, int lenght, Direction _direction) : base()
 {
     direction = _direction;
     Hangry    = true;
     for (int i = 0; i < lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #30
0
        public void Move()
        {
            Point tail      = pList.First();
            Point head      = pList.Last();
            Point NextPoint = new Point(head);

            tail.Clear();
            pList.Remove(tail);
            NextPoint.Move(1, direction);
            NextPoint.Draw();
            pList.Add(NextPoint);
        }
Exemple #31
0
        private Point GetNextPoint()
        {
            Point newHead = null;
            Point head    = _PointList.LastOrDefault();

            if (head != null)
            {
                newHead = new Point(head);
                newHead.Move(1, Direction);
            }
            return(newHead);
        }
Exemple #32
0
        public Snake(Point tail, int length, Direction _dir)
        {
            pList = new List <Point>();
            dir   = _dir;

            for (int i = 0; i <= length; i += 1)
            {
                Point p = new Point(tail);
                p.Move(i, _dir);
                pList.Add(p);
            }
        }
Exemple #33
0
 public Snake(Point tail, int length, Direction _direction)
 {
     direction = _direction;
     pList     = new List <Point>();
     pList.Add(tail);
     for (int i = 1; i < length; i++)
     {
         Point x = new Point(tail);
         x.Move(i, direction);
         pList.Add(x);
     }
 }
Exemple #34
0
        public Snake(Point taile, int lenght, Direction _direction)
        {
            direction = _direction;
            pList     = new List <Point>();

            for (int i = 0; i < lenght; i++)    // хвостовую точку сдвигаем в направлении direction на значение длины змейки
            {
                Point p = new Point(taile);
                p.Move(i, direction);
                pList.Add(p);
            }
        }
Exemple #35
0
 public Snake(Point tail, int length, Direction _direction)
 {
     direction = _direction;
     pList = new List<Point>();
     //Snake snake = new Snake(p, 5, Direction.RIGHT);
     for (int i = 0; i < length; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
     }
 }
Exemple #36
0
 public Snake(Point tail, int lenght, Direction direction)
 {
     Direction   = direction;
     StartLenght = lenght;
     _PointList  = new List <Point>();
     for (int i = 0; i < lenght; i++)
     {
         Point point = new Point(tail);
         point.Move(i, direction);
         _PointList.Add(point);
     }
 }
        public Snake(Point snakeTail, int snakeLenght, Direction _direction)
        {
            direction = _direction;

            pList = new List <Point>();
            for (int i = 0; i < snakeLenght; i++)
            {
                Point p = new Point(snakeTail);
                p.Move(i, direction);
                pList.Add(p);
            }
        }
Exemple #38
0
        public Snake(Point tail, int length, Direction direction)
        {
            this.direction = direction;
            this.length = length;

            plist = new List<Point>();
            for (int iter = 0; iter < this.length; iter++)
            {
                Point p = new Point(tail);
                p.Move(iter, direction);
                plist.Add(p);
            }
        }
Exemple #39
0
 public Snake( Point tail, int lenght, Directions direction )
 {
     pList = new List<Point>();
     for ( int i = 0; i < lenght; i++ )  // пока не дойдем до длины
     {
      var p = new Point(tail); // Создаем точку. В первой итерации, когда I = 0, это будет начальной точкой хвостом.
         // В следующих итерациях, мы хвосту прибавлять точки методом Move.
         // Т.е. если зададим начальную точку (3;4) и укажем, что у глиста будет длина 2 и направление влево
         // то в первой итерации точка так и останется 3,4. Во второй итерации, мы отнимем с точки Х (она имеет значение 3) единицу. И новая точка будет иметь координаты (2;4)
         p.Move( i, direction ); // двигаем точку по направлению
         pList.Add( p );
     }
 }
Exemple #40
0
 public Snake(Point tail, int lengh, Direction _direction)
 {
     direction = _direction;
     objectType = ObjectTypes.SNAKE;
     pList = new List<Point>();
     for(int i = 0; i < lengh; i++)
     {
         // Пересоздаём точку и передвигаем её, тем самым рисуя змейку
         Point p = new Point(tail);
         p.Move(i, direction);
         pList.Add(p);
         Draw();
     }
 }
Exemple #41
0
 private Point GetNewPoint()
 {
     Point newPoint = new Point( pList.Last() );
     newPoint.Move(1, direction);
     return newPoint;
 }
Exemple #42
0
 public Point GetNextPoint()
 {
     Point nextLast = new Point(pList.Last());
     nextLast.Move(1, direction);
     return nextLast;
 }
Exemple #43
0
 public Point GetNextPoint()
 {
     Point newpoint = new Point(points.Last());
     newpoint.Move(1, direction);
     return newpoint;
 }