Class PlantInfoService
java.lang.Object
com.csse3200.game.services.plants.PlantInfoService
Keeps track of all info and stats relating to plants.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the number of alive plantsintGets the total number of decaying plantsGetter for the event handler.intGets the total number plants harvestedintGets the total number of seeds plantedvoidincreasePlantGrowthStageCount(int num, String growthStage) Increase the number of plants at a certain growth stage.voidincreasePlantsHarvested(int num, String plantName) Increase the total count of plants harvested by an integer value.voidincreaseSeedsPlanted(int num, String plantName) Increase the number of seeds planted by an integer value.Return a formatted string with all relevant information about the plants.voidsetDecayingPlantCount(int num) Sets the decaying plant counter to the number providedvoidsetEvents(EventHandler events) Setter for the event handler.voidTrigger the 'clearInfo' event to update the plant info ui.
-
Constructor Details
-
PlantInfoService
public PlantInfoService()Constructor for the plant info service. Initialise all counts to zero.
-
-
Method Details
-
getEvents
Getter for the event handler.- Returns:
- the event handler.
-
setEvents
Setter for the event handler. Used for testing- Parameters:
events- the event handler.
-
getAlivePlantCount
public int getAlivePlantCount()Gets the number of alive plants- Returns:
- the number of alive plants
-
getTotalSeedsPlanted
public int getTotalSeedsPlanted()Gets the total number of seeds planted- Returns:
- the total number of seeds planted
-
getTotalPlantHarvestCount
public int getTotalPlantHarvestCount()Gets the total number plants harvested- Returns:
- the total number of plants harvested
-
getDecayingPlantCount
public int getDecayingPlantCount()Gets the total number of decaying plants- Returns:
- the total number of decaying plants
-
setDecayingPlantCount
public void setDecayingPlantCount(int num) Sets the decaying plant counter to the number provided- Parameters:
num- the number to set the decaying plant counter to
-
increasePlantGrowthStageCount
Increase the number of plants at a certain growth stage.- Parameters:
num- - Integer value.growthStage- - the growth stage of the plant.
-
increaseSeedsPlanted
Increase the number of seeds planted by an integer value. Also takes the name of the plant that has been planted.- Parameters:
num- - Integer value.plantName- - Name of a valid plant.
-
increasePlantsHarvested
Increase the total count of plants harvested by an integer value. Also keeps track of how many of each type of plant have been harvested.- Parameters:
num- - Integer value.plantName- - Name of the plant that has been harvested.
-
updateClearInfo
public void updateClearInfo()Trigger the 'clearInfo' event to update the plant info ui. -
plantInfoSummary
Return a formatted string with all relevant information about the plants.- Returns:
- - formatted string with relevant information about plants.
-