Class ShipActions
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.ships.ShipActions
Action component for interacting with the player. Ship events should be initialised in create()
and when triggered should call methods within this class.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionShipActions(int health, int fuel, int acceleration) Initialize the health, fuel and acceleration of the ship -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Initialize animation and physics of the shipintget the amount of fuelintget the amount of healthvoidsetFuel(int fuel) Changes the max available fuel for the shipvoidsetHealth(int health) Changes the max health of the shipvoidupdate()Called each render call.voidInform ShipStatsDisplay about new fuel valuevoidInform ShipStatsDisplay about new health valueMethods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
ShipActions
public ShipActions(int health, int fuel, int acceleration) Initialize the health, fuel and acceleration of the ship- Parameters:
health-fuel-acceleration-
-
-
Method Details
-
create
public void create()Initialize animation and physics of the ship -
update
public void update()Called each render call. Updates the speed of the ship -
setFuel
public void setFuel(int fuel) Changes the max available fuel for the ship- Parameters:
fuel-
-
setHealth
public void setHealth(int health) Changes the max health of the ship- Parameters:
health-
-
getMaxFuel
public int getMaxFuel()get the amount of fuel- Returns:
- maxFuel
-
getMaxHealth
public int getMaxHealth()get the amount of health- Returns:
- maxHealth
-
updatedHealth
public void updatedHealth()Inform ShipStatsDisplay about new health value -
updatedFuel
public void updatedFuel()Inform ShipStatsDisplay about new fuel value
-