| | | 1 | | using GridForge.Spatial; |
| | | 2 | | |
| | | 3 | | namespace GridForge.Grids; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Immutable snapshot describing a single obstacle mutation on a voxel. |
| | | 7 | | /// </summary> |
| | | 8 | | public readonly struct ObstacleEventInfo |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// The voxel affected by the obstacle mutation. |
| | | 12 | | /// </summary> |
| | | 13 | | public readonly WorldVoxelIndex VoxelIndex; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// The token identifying the obstacle that was added or removed. |
| | | 17 | | /// </summary> |
| | | 18 | | public readonly BoundsKey ObstacleToken; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// The number of active obstacles on the voxel after the mutation completes. |
| | | 22 | | /// </summary> |
| | | 23 | | public readonly byte ObstacleCount; |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// The grid version recorded after the mutation completes. |
| | | 27 | | /// </summary> |
| | | 28 | | public readonly uint GridVersion; |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// The grid index containing <see cref="VoxelIndex"/>. |
| | | 32 | | /// </summary> |
| | 1 | 33 | | public readonly ushort GridIndex => VoxelIndex.GridIndex; |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Initializes a new immutable obstacle mutation snapshot. |
| | | 37 | | /// </summary> |
| | | 38 | | public ObstacleEventInfo( |
| | | 39 | | WorldVoxelIndex voxelIndex, |
| | | 40 | | BoundsKey obstacleToken, |
| | | 41 | | byte obstacleCount, |
| | | 42 | | uint gridVersion) |
| | | 43 | | { |
| | 716 | 44 | | VoxelIndex = voxelIndex; |
| | 716 | 45 | | ObstacleToken = obstacleToken; |
| | 716 | 46 | | ObstacleCount = obstacleCount; |
| | 716 | 47 | | GridVersion = gridVersion; |
| | 716 | 48 | | } |
| | | 49 | | } |