Class PlanetOxygenService

java.lang.Object
com.csse3200.game.services.PlanetOxygenService
All Implemented Interfaces:
OxygenLevel

public class PlanetOxygenService extends Object implements OxygenLevel
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 handler
    float
    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 planet
    void
    Perform the update on the oxygen present by applying the recalculated hour delta.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface OxygenLevel
      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 interface OxygenLevel
      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 interface OxygenLevel
      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 interface OxygenLevel
      Parameters:
      oxygen - the float number of kilograms to set the oxygen level to.
    • getOxygenPercentage

      public int getOxygenPercentage() throws IllegalArgumentException
      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 interface OxygenLevel
      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

      public void setOxygenGoal(int kilograms) throws IllegalArgumentException
      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

      public EventHandler 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.