| | | 1 | | //======================================================================= |
| | | 2 | | // GridCommittedChange.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 | | namespace GridForge.Grids; |
| | | 9 | | |
| | | 10 | | internal enum GridExactChangeKind : byte |
| | | 11 | | { |
| | | 12 | | None = 0, |
| | | 13 | | ObstacleAdded = 1, |
| | | 14 | | ObstacleRemoved = 2, |
| | | 15 | | ObstaclesCleared = 3, |
| | | 16 | | } |
| | | 17 | | |
| | | 18 | | internal readonly struct GridCommittedChange |
| | | 19 | | { |
| | | 20 | | public readonly GridEventInfo GridEvent; |
| | | 21 | | public readonly GridExactChangeKind ExactKind; |
| | | 22 | | public readonly ObstacleEventInfo ObstacleEvent; |
| | | 23 | | public readonly ObstacleClearEventInfo ObstacleClearEvent; |
| | | 24 | | public readonly Voxel? TargetVoxel; |
| | | 25 | | |
| | | 26 | | public GridCommittedChange(GridEventInfo gridEvent) |
| | | 27 | | { |
| | 1815 | 28 | | GridEvent = gridEvent; |
| | 1815 | 29 | | ExactKind = GridExactChangeKind.None; |
| | 1815 | 30 | | ObstacleEvent = default; |
| | 1815 | 31 | | ObstacleClearEvent = default; |
| | 1815 | 32 | | TargetVoxel = null; |
| | 1815 | 33 | | } |
| | | 34 | | |
| | | 35 | | public GridCommittedChange( |
| | | 36 | | GridEventInfo gridEvent, |
| | | 37 | | GridExactChangeKind exactKind, |
| | | 38 | | ObstacleEventInfo obstacleEvent, |
| | | 39 | | Voxel targetVoxel) |
| | | 40 | | { |
| | 1115 | 41 | | GridEvent = gridEvent; |
| | 1115 | 42 | | ExactKind = exactKind; |
| | 1115 | 43 | | ObstacleEvent = obstacleEvent; |
| | 1115 | 44 | | ObstacleClearEvent = default; |
| | 1115 | 45 | | TargetVoxel = targetVoxel; |
| | 1115 | 46 | | } |
| | | 47 | | |
| | | 48 | | public GridCommittedChange( |
| | | 49 | | GridEventInfo gridEvent, |
| | | 50 | | ObstacleClearEventInfo obstacleClearEvent, |
| | | 51 | | Voxel targetVoxel) |
| | | 52 | | { |
| | 565 | 53 | | GridEvent = gridEvent; |
| | 565 | 54 | | ExactKind = GridExactChangeKind.ObstaclesCleared; |
| | 565 | 55 | | ObstacleEvent = default; |
| | 565 | 56 | | ObstacleClearEvent = obstacleClearEvent; |
| | 565 | 57 | | TargetVoxel = targetVoxel; |
| | 565 | 58 | | } |
| | | 59 | | } |