Package com.csse3200.game.services
Class PlanetOxygenService
java.lang.Object
com.csse3200.game.services.PlanetOxygenService
- All Implemented Interfaces:
OxygenLevel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOxygen(float kilogramsToAdd) Add x kilograms of oxygen to the object in question.floatGetter for the default initial oxygen value.Gets the PlanetOxygenService's event handlerfloatGets the amount of oxygen present in the object in kilos.floatGets the maximum/goal amount of oxygen to be present on the planet.intGets the oxygen present as a percentage of the upper limit (Float 0.0 - 100.0).voidremoveOxygen(float kilogramsToRemove) Remove x kilograms of oxygen from the object in question.voidsetOxygen(float oxygen) Sets the amount of oxygen present in the object in kilos.voidsetOxygenGoal(int kilograms) Set the maximum/goal amount of oxygen to be present on the planetvoidupdate()Perform the update on the oxygen present by applying the recalculated hour delta.
-
Constructor Details
-
PlanetOxygenService
public PlanetOxygenService()
-
-
Method Details
-
addOxygen
public void addOxygen(float kilogramsToAdd) Description copied from interface:OxygenLevelAdd x kilograms of oxygen to the object in question.- Specified by:
addOxygenin interfaceOxygenLevel- Parameters:
kilogramsToAdd- the float number of kilograms to add.
-
removeOxygen
public void removeOxygen(float kilogramsToRemove) Description copied from interface:OxygenLevelRemove x kilograms of oxygen from the object in question.- Specified by:
removeOxygenin interfaceOxygenLevel- Parameters:
kilogramsToRemove- the float number of kilograms to remove.
-
getOxygen
public float getOxygen()Description copied from interface:OxygenLevelGets the amount of oxygen present in the object in kilos.- Specified by:
getOxygenin interfaceOxygenLevel- Returns:
- the amount of oxygen present in kilos.
-
setOxygen
public void setOxygen(float oxygen) Description copied from interface:OxygenLevelSets the amount of oxygen present in the object in kilos.- Specified by:
setOxygenin interfaceOxygenLevel- Parameters:
oxygen- the float number of kilograms to set the oxygen level to.
-
getOxygenPercentage
Description copied from interface:OxygenLevelGets the oxygen present as a percentage of the upper limit (Float 0.0 - 100.0).- Specified by:
getOxygenPercentagein interfaceOxygenLevel- Returns:
- The oxygen present as a percentage of the upper limit.
- Throws:
IllegalArgumentException
-
setOxygenGoal
Set the maximum/goal amount of oxygen to be present on the planet- Parameters:
kilograms- the number of kilograms the goal is set to.- Throws:
IllegalArgumentException
-
getOxygenGoal
public float getOxygenGoal()Gets the maximum/goal amount of oxygen to be present on the planet.- Returns:
- kilograms of oxygen
-
getEvents
Gets the PlanetOxygenService's event handler- Returns:
- the event handler
-
getDefaultInitialOxygen
public float getDefaultInitialOxygen()Getter for the default initial oxygen value.- Returns:
- the default initial/'starting' oxygen value.
-
update
public void update()Perform the update on the oxygen present by applying the recalculated hour delta. If level reaches 0, trigger lose screen. Triggers an event to update the oxygen display.
-