private void GenerateBody() { int x = DefaultX; int y = DefaultY; for (int i = 0; i < SnakeLength; i++) { var point = new SnakePoint(x, y); this.body.Enqueue(point); x++; } }
public SnakePoint GetHead() { SnakePoint oldHead = this.body.Last(); int newX = oldHead.CoordinateX; int newY = oldHead.CoordinateY; switch (this.Direction) { case Direction.Right: newX++; break; case Direction.Left: newX--; break; case Direction.Down: newY++; break; case Direction.Up: newY--; break; } return(new SnakePoint(newX, newY)); }