Skip to content

Commit c30b6c9

Browse files
committed
Refactored states for the editor to increase code reuse
1 parent ecd3eaa commit c30b6c9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Assets/Code/HexTiles/Editor/HexTileMapEditor.cs

+4-6
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private void Initialise()
307307
}
308308
})
309309
.End()
310-
.State<EraseState>("Erase")
310+
.State<ChunkEditingState>("Erase")
311311
.Enter(evt => selectedToolIndex = 3)
312312
.Update((state, dt) =>
313313
{
@@ -754,19 +754,17 @@ private void HighlightTilesUnderMousePosition()
754754
/// <summary>
755755
/// State for when we're painting tiles.
756756
/// </summary>
757-
private class PaintState : AbstractState
757+
private class PaintState : ChunkEditingState
758758
{
759759
public float PaintHeight;
760760

761761
public float PaintOffset;
762-
763-
public HashSet<HexChunk> ModifiedChunks = new HashSet<HexChunk>();
764762
}
765763

766764
/// <summary>
767-
/// State for when we're erasing tiles.
765+
/// Base class for states that modify tile chunks.
768766
/// </summary>
769-
private class EraseState : AbstractState
767+
private class ChunkEditingState : AbstractState
770768
{
771769
public HashSet<HexChunk> ModifiedChunks = new HashSet<HexChunk>();
772770
}

0 commit comments

Comments
 (0)