Class CollectItemsAchievement
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.achievements.Achievement
com.csse3200.game.missions.achievements.CollectItemsAchievement
An
Achievement completed by collecting a certain number of items-
Constructor Summary
ConstructorsConstructorDescriptionCollectItemsAchievement(String name, int numberOfItems) An achievement where player is required to collect a certain number of items -
Method Summary
Modifier and TypeMethodDescriptionThe description of the Achievement to give a representation of the player's progress in the Achievement.Get the number of debris the player has cleared since Achievements was registered.Gives the player's progress in the CollectItemsAchievement.booleanChecks if the CollectItemsAchievement is completevoidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Read in the number of items the player has collected from a JsonValue.voidregisterMission(EventHandler missionManagerEvents) Registers the Achievement with theMissionManagerby listening to the ITEMS_COLLECTED Mission event.protected voidResets the number of debris cleared to 0.protected voidUpdating the state of the CollectItemsAchievement.Methods inherited from class com.csse3200.game.missions.achievements.Achievement
writeMethods inherited from class com.csse3200.game.missions.Mission
getName, notifyUpdate
-
Constructor Details
-
CollectItemsAchievement
An achievement where player is required to collect a certain number of items- Parameters:
name- - Human-readable name of the Achievement.numberOfItems- - Amount of items the player needs to collect.
-
-
Method Details
-
registerMission
Registers the Achievement with theMissionManagerby listening to the ITEMS_COLLECTED Mission event.- Specified by:
registerMissionin classMission- Parameters:
missionManagerEvents- - A reference to theEventHandleron theMissionManager, with which relevant events should be listened to.
-
updateState
protected void updateState()Updating the state of the CollectItemsAchievement. If called this method will increment the numberOfItemsCollected and then notifyUpdate(). -
isCompleted
public boolean isCompleted()Checks if the CollectItemsAchievement is complete- Specified by:
isCompletedin classMission- Returns:
- - True if player has cleared at least numberOfItemsToCollect, otherwise False.
-
getDescription
The description of the Achievement to give a representation of the player's progress in the Achievement.- Specified by:
getDescriptionin classMission- Returns:
- - Human-readable description of the CollectItemsAchievement.
-
getShortDescription
Gives the player's progress in the CollectItemsAchievement.- Specified by:
getShortDescriptionin classMission- Returns:
- - Human-readable String of how many items the player has collected and how many they have left to collect
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Read in the number of items the player has collected from a JsonValue.- Specified by:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
Get the number of debris the player has cleared since Achievements was registered.- Specified by:
getProgressin classMission- Returns:
- - number of items collected
-
resetState
protected void resetState()Resets the number of debris cleared to 0.
-