18 lines
428 B
Java
18 lines
428 B
Java
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");
|
|
}
|
|
}
|
|
}
|