Class PlantInfoService

java.lang.Object
com.csse3200.game.services.plants.PlantInfoService

public class PlantInfoService extends Object
Keeps track of all info and stats relating to plants.
  • Constructor Details

    • PlantInfoService

      public PlantInfoService()
      Constructor for the plant info service. Initialise all counts to zero.
  • Method Details

    • getEvents

      public EventHandler getEvents()
      Getter for the event handler.
      Returns:
      the event handler.
    • setEvents

      public void setEvents(EventHandler events)
      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

      public void increasePlantGrowthStageCount(int num, String growthStage)
      Increase the number of plants at a certain growth stage.
      Parameters:
      num - - Integer value.
      growthStage - - the growth stage of the plant.
    • increaseSeedsPlanted

      public void increaseSeedsPlanted(int num, String plantName)
      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

      public void increasePlantsHarvested(int num, String plantName)
      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

      public String plantInfoSummary()
      Return a formatted string with all relevant information about the plants.
      Returns:
      - formatted string with relevant information about plants.