Class ShipProgressComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.ship.ShipProgressComponent
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable

public class ShipProgressComponent extends Component
  • Constructor Details

    • ShipProgressComponent

      public ShipProgressComponent()
  • Method Details

    • create

      public void create()
      This component will handle the Ship's internal state of repair. It will listen for addPart events on the Ship Entity, which will pass the number of Ship Part Items the player is using on the ship, and increment its internal state of repair by that amount. It will also trigger a progressUpdated event on the Ship Entity along with the current state of repair for other components to use.
      Overrides:
      create in class Component
    • getProgress

      public int getProgress()
      Get current repair status. Do not use this to infer unlocked features - use getUnlockedFeatures() for that.
      Returns:
      current repair status
    • getUnlockedFeatures

      public Set<ShipProgressComponent.Feature> getUnlockedFeatures()
      Get unlocked features. Features may be unlocked even if the repair status wouldn't indicate this to be the case currently.
      Returns:
      A set of unlocked features
    • write

      public void write(com.badlogic.gdx.utils.Json json)
      Store the progress data on the ship in the passed-in json object.
      Specified by:
      write in interface com.badlogic.gdx.utils.Json.Serializable
      Overrides:
      write in class Component
      Parameters:
      json - Json object to write to
    • read

      public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonMap)
      Update the entity based on the read data.
      Specified by:
      read in interface com.badlogic.gdx.utils.Json.Serializable
      Overrides:
      read in class Component
      Parameters:
      json - which is a valid Json that is read from
      jsonMap - which is a valid JsonValue that is read from