| | | 1 | | //======================================================================= |
| | | 2 | | // OccupantEventInfo.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024–present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using GridForge.Spatial; |
| | | 9 | | |
| | | 10 | | namespace GridForge.Grids; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Immutable snapshot describing an occupant mutation on a voxel. |
| | | 14 | | /// </summary> |
| | | 15 | | public readonly struct OccupantEventInfo |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// The voxel affected by the occupant mutation. |
| | | 19 | | /// </summary> |
| | | 20 | | public readonly WorldVoxelIndex VoxelIndex; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// The occupant that was added to or removed from the voxel. |
| | | 24 | | /// </summary> |
| | | 25 | | public readonly IVoxelOccupant Occupant; |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// The scan-cell ticket assigned to the occupant for this voxel. |
| | | 29 | | /// </summary> |
| | | 30 | | public readonly int Ticket; |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// The number of occupants on the voxel after the mutation completes. |
| | | 34 | | /// </summary> |
| | | 35 | | public readonly byte OccupantCount; |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// The grid index containing <see cref="VoxelIndex"/>. |
| | | 39 | | /// </summary> |
| | 1 | 40 | | public readonly ushort GridIndex => VoxelIndex.GridIndex; |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Initializes a new immutable occupant mutation snapshot. |
| | | 44 | | /// </summary> |
| | | 45 | | public OccupantEventInfo( |
| | | 46 | | WorldVoxelIndex voxelIndex, |
| | | 47 | | IVoxelOccupant occupant, |
| | | 48 | | int ticket, |
| | | 49 | | byte occupantCount) |
| | | 50 | | { |
| | 556 | 51 | | VoxelIndex = voxelIndex; |
| | 556 | 52 | | Occupant = occupant; |
| | 556 | 53 | | Ticket = ticket; |
| | 556 | 54 | | OccupantCount = occupantCount; |
| | 556 | 55 | | } |
| | | 56 | | } |