added lab10 ex1

This commit is contained in:
2024-11-04 10:36:21 +01:00
parent 73129fd4c1
commit dfd4dba1d7
3 changed files with 145 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package lab10_memento.ex1;
public class CheckpointManager {
private Player.Checkpoint lastCheckpoint = null;
public void save(Player player) {
lastCheckpoint = player.makeCheckpoint();
}
public void restore(Player player) {
if (lastCheckpoint != null) {
lastCheckpoint.restore(player);
} else {
System.out.println("No checkpoint to restore");
}
}
}