Exemplo n.º 1
0
 public void Create()
 {
     int posX = 0;
     int posY = 0;
     gridNodes = new Node[gridSizeX, gridSizeY];
     for (int i = 0; i < gridSizeX; i++)
     {
         for (int j = 0; j < gridSizeY; j++)
         {
             GridBlock block = new GridBlock(new Point(posX, posY), GridBlock.BlockType.Way);
             if (i == 0 && j == 0)
                 block.Type = GridBlock.BlockType.Start;
             else if (j == 14 && i == 14)
                 block.Type = GridBlock.BlockType.End;
             gridNodes[i, j] = new Node(i, j, block);
             posX += 20;
         }
         posX = 0;
         posY += 20;
     }
     this.start = gridNodes[0, 0];
     this.end = gridNodes[14, 14];
 }
Exemplo n.º 2
0
 public Node(int _gridX, int _gridY, GridBlock _gridBlock)
 {
     gridX = _gridX;
     gridY = _gridY;
     gridBlock = _gridBlock;
 }
Exemplo n.º 3
0
 public void SetNodeTypeInPosition(int _x, int _y, GridBlock.BlockType _type)
 {
     gridNodes[_x, _y].GridBlock.Type = _type;
     if (_type == GridBlock.BlockType.Start)
         StartNode = gridNodes[_x, _y];
     else if (_type == GridBlock.BlockType.End)
         EndNode = gridNodes[_x, _y];
 }