/// <summary>
 /// Draws the current VoxelGrid state with mesh voxels
 /// </summary>
 void DrawState()
 {
     for (int x = 0; x < _gridSize.x; x++)
     {
         for (int y = 0; y < _gridSize.y; y++)
         {
             for (int z = 0; z < _gridSize.z; z++)
             {
                 if (_grid.Voxels[x, y, z].IsOccupied)
                 {
                     for (int i = 0; i < 6; i++)
                     {
                         var voxel = _grid.Voxels[x, y, z];
                         if (voxel.Part.Type == PartType.Configurable)
                         {
                             PP_Drawing.DrawConfigurable(_grid.Voxels[x, y, z].Center + new Vector3(0, (i + 1) * _voxelSize, 0), _grid.VoxelSize, Color.black);
                         }
                         else
                         {
                             PP_Drawing.DrawCube(_grid.Voxels[x, y, z].Center + new Vector3(0, (i + 1) * _voxelSize, 0), _grid.VoxelSize, 1);
                         }
                     }
                 }
                 if (_grid.Voxels[x, y, z].IsActive)
                 {
                     PP_Drawing.DrawCube(_grid.Voxels[x, y, z].Center, _grid.VoxelSize, 0);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Draws the current VoxelGrid state with mesh voxels
 /// </summary>
 protected override void DrawState()
 {
     for (int x = 0; x < _gridSize.x; x++)
     {
         for (int y = 0; y < _gridSize.y; y++)
         {
             for (int z = 0; z < _gridSize.z; z++)
             {
                 Vector3 index = new Vector3(x + 0.5f, y + 0.5f, z + 0.5f) * _voxelSize;
                 //Vector3 index = new Vector3(x , y , z) * _voxelSize;
                 if (MainGrid.Voxels[x, y, z].IsOccupied)
                 {
                     for (int i = 0; i < 8; i++)
                     {
                         var voxel = MainGrid.Voxels[x, y, z];
                         if (voxel.Part.Type == PartType.Configurable)
                         {
                             //PP_Drawing.DrawConfigurable(transform.position + _grid.Voxels[x, y, z].Center + new Vector3(0, (i + 1) * _voxelSize, 0), _grid.VoxelSize, 1);
                             PP_Drawing.DrawConfigurable(transform.position + index + new Vector3(0, (i + 1) * _voxelSize, 0), MainGrid.VoxelSize, Color.black);
                         }
                         else
                         {
                             //PP_Drawing.DrawCube(transform.position +  _grid.Voxels[x, y, z].Center + new Vector3(0, (i + 1) * _voxelSize, 0), _grid.VoxelSize, 1);
                             PP_Drawing.DrawCube(transform.position + index + new Vector3(0, (i + 1) * _voxelSize, 0), MainGrid.VoxelSize, 1);
                         }
                     }
                 }
             }
         }
     }
 }