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 TypeMethodDescriptionvoid
addOxygen
(float kilogramsToAdd) Add x kilograms of oxygen to the object in question.float
Getter for the default initial oxygen value.Gets the PlanetOxygenService's event handlerfloat
Gets the amount of oxygen present in the object in kilos.float
Gets the maximum/goal amount of oxygen to be present on the planet.int
Gets the oxygen present as a percentage of the upper limit (Float 0.0 - 100.0).void
removeOxygen
(float kilogramsToRemove) Remove x kilograms of oxygen from the object in question.void
setOxygen
(float oxygen) Sets the amount of oxygen present in the object in kilos.void
setOxygenGoal
(int kilograms) Set the maximum/goal amount of oxygen to be present on the planetvoid
update()
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:OxygenLevel
Add x kilograms of oxygen to the object in question.- Specified by:
addOxygen
in interfaceOxygenLevel
- Parameters:
kilogramsToAdd
- the float number of kilograms to add.
-
removeOxygen
public void removeOxygen(float kilogramsToRemove) Description copied from interface:OxygenLevel
Remove x kilograms of oxygen from the object in question.- Specified by:
removeOxygen
in interfaceOxygenLevel
- Parameters:
kilogramsToRemove
- the float number of kilograms to remove.
-
getOxygen
public float getOxygen()Description copied from interface:OxygenLevel
Gets the amount of oxygen present in the object in kilos.- Specified by:
getOxygen
in interfaceOxygenLevel
- Returns:
- the amount of oxygen present in kilos.
-
setOxygen
public void setOxygen(float oxygen) Description copied from interface:OxygenLevel
Sets the amount of oxygen present in the object in kilos.- Specified by:
setOxygen
in interfaceOxygenLevel
- Parameters:
oxygen
- the float number of kilograms to set the oxygen level to.
-
getOxygenPercentage
Description copied from interface:OxygenLevel
Gets the oxygen present as a percentage of the upper limit (Float 0.0 - 100.0).- Specified by:
getOxygenPercentage
in interfaceOxygenLevel
- Returns:
- The oxygen present as a percentage of the upper limit.
- Throws:
IllegalArgumentException
-
getOxygenGoal
public float getOxygenGoal()Gets the maximum/goal amount of oxygen to be present on the planet.- Returns:
- kilograms of oxygen
-
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
-
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.
-