Class PlantCropsAchievement
java.lang.Object
com.csse3200.game.missions.Mission
com.csse3200.game.missions.achievements.Achievement
com.csse3200.game.missions.achievements.PlantCropsAchievement
An
Achievement completed by planting a certain number of crops on crop tiles.-
Constructor Summary
ConstructorsConstructorDescriptionPlantCropsAchievement(String name, int numberOfCropsToPlant) Creates aPlantCropsAchievement. -
Method Summary
Modifier and TypeMethodDescriptionReturns a description of thePlantCropsAchievementwith the name of the achievement and the player's progress.Gives the progress of thePlantCropsAchievementGives a short description of thePlantCropsAchievementshowing the player's progress in the achievement.booleanReturns true if the number of crops the player has planted is greater than or equal to the target number of plants.voidreadProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the progress of thePlantCropsAchievementfrom a JsonValue.voidregisterMission(EventHandler missionManagerEvents) Registers thePlantCropsAchievementwith theMissionManagerby adding a listener to the PLANT_CROPMissionManager.MissionEventprotected voidupdateState(String ignored) Increments the number of plants the player has planted.Methods inherited from class com.csse3200.game.missions.achievements.Achievement
writeMethods inherited from class com.csse3200.game.missions.Mission
getName, notifyUpdate
-
Constructor Details
-
PlantCropsAchievement
Creates aPlantCropsAchievement.- Parameters:
name- The name of thePlantCropsAchievementnumberOfCropsToPlant- The target number of crops to plant to reach this achievement
-
-
Method Details
-
registerMission
Registers thePlantCropsAchievementwith theMissionManagerby adding a listener to the PLANT_CROPMissionManager.MissionEvent- Specified by:
registerMissionin classMission- Parameters:
missionManagerEvents- A reference to theEventHandleron theMissionManager, with which relevant events should be listened to.
-
isCompleted
public boolean isCompleted()Returns true if the number of crops the player has planted is greater than or equal to the target number of plants.- Specified by:
isCompletedin classMission- Returns:
- True if the player has planted the target number of plants.
-
getDescription
Returns a description of thePlantCropsAchievementwith the name of the achievement and the player's progress.- Specified by:
getDescriptionin classMission- Returns:
- - the
PlantCropsAchievement's description
-
getShortDescription
Gives a short description of thePlantCropsAchievementshowing the player's progress in the achievement.- Specified by:
getShortDescriptionin classMission- Returns:
- - short description of the
PlantCropsAchievement
-
readProgress
public void readProgress(com.badlogic.gdx.utils.JsonValue progress) Reads in the progress of thePlantCropsAchievementfrom a JsonValue.- Specified by:
readProgressin classMission- Parameters:
progress- TheJsonValuerepresenting the progress of theMissionas determined by the value returned ingetProgress().
-
getProgress
Gives the progress of thePlantCropsAchievement- Specified by:
getProgressin classMission- Returns:
- - the number of crops the player has planted since creation of the
PlantCropsAchievement.
-
updateState
Increments the number of plants the player has planted.- Parameters:
ignored- TheStringrepresentation of the plant type. Irrelevant for thisAchievement.
-