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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Ship features that can be unlocked along by repairing the ship. -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
This component will handle the Ship's internal state of repair.int
Get current repair status.Get unlocked features.void
read
(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonMap) Update the entity based on the read data.void
write
(com.badlogic.gdx.utils.Json json) Store the progress data on the ship in the passed-in json object.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
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. -
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
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. -
read
public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonMap) Update the entity based on the read data.
-