コード例 #1
0
 private void VisualizeUsingPrimitives(MapGrid grid, MapData data)
 {
     PlaceStartAndExitPoints(data);
     for (int i = 0; i < data.obstacleArray.Length; i++)
     {
         if (data.obstacleArray[i])
         {
             var positionOnGrid = grid.CalculateCoordinatesFromIndex(i);
             if (positionOnGrid == data.startPosition || positionOnGrid == data.exitPosition)
             {
                 continue;
             }
             grid.SetCell(positionOnGrid.x, positionOnGrid.z, CellObjectType.Obstacle);
             if (PlaceKnightObstacle(data, positionOnGrid))
             {
                 continue;
             }
         }
     }
 }
コード例 #2
0
 private void VisualizeUsingPrimitives(MapGrid grid, MapData data)
 {
     PlaceStartAndExitPoints(data);
     for (int i = 0; i < data.obstacleArray.Length; i++)
     {
         if (data.obstacleArray[i])
         {
             var positionOnGrid = grid.CalculateCoordinatesFromIndex(i);
             if (positionOnGrid == data.startPosition || positionOnGrid == data.exitPosition)
             {
                 continue;
             }
             grid.SetCell(positionOnGrid.x, positionOnGrid.z, CellObjectType.Obstacle);
             if (PlaceKnightObstacle(data, positionOnGrid))
             {
                 continue;
             }
             if (dictionaryOfObstacles.ContainsKey(positionOnGrid) == false)
             {
                 CreateIndicator(positionOnGrid, Color.white, PrimitiveType.Cube);
             }
         }
     }
 }