Package com.deco2800.game.memento
Class CareTaker
java.lang.Object
com.deco2800.game.memento.CareTaker
the caretaker object records and stores the player state into the internal memory for the engine to retrieve in the
future
A combination of singleton and memento design pattern, which allows memento to be retrieved from anywhere in the game
and restrict it to only having one instance, hence preventing duplication of memento and allows better management
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CareTaker
public CareTaker()
-
-
Method Details
-
getInstance
-
deleteAll
public static void deleteAll() -
add
adds the selected memento into the caretaker- Parameters:
state
- - the memento to be stored
-
getLast
retrieve the last memento saved- Returns:
- - the last memento
-
size
public int size()retrieve the entire list of the caretaker- Returns:
- - the list of the previously saved memento
-