feat: implement game saving and loading in TicTacToe
- Add serialization support to `World`, `EntityAllocator`, and `SparseSet` - Implement `SaveGame` and `LoadGame` functionality in the TicTacToe example - Add ability to resume a game from a saved state - Implement auto-save after every move in the game loop
This commit is contained in:
@@ -38,9 +38,9 @@ public struct PlaceMarkCommand : ICommand
|
||||
if (target == null)
|
||||
return; // Cell already occupied or invalid position.
|
||||
|
||||
// Place the mark.
|
||||
// Place the mark. ComponentAdded is sufficient — MarkModified
|
||||
// is only needed when mutating an existing component via GetComponent<T>.
|
||||
world.AddComponent(target.Value, new Mark { Player = state.CurrentPlayer });
|
||||
world.MarkModified<Mark>(target.Value);
|
||||
|
||||
// Advance turn.
|
||||
state.MoveCount++;
|
||||
|
||||
Reference in New Issue
Block a user