Class DayNightCycle

java.lang.Object
com.csse3200.game.lighting.DayNightCycle

public class DayNightCycle extends Object
Handles ambient lighting for the game to produce a day/night cycle effect. Controls time of day and day length, and can pause and resume the cycle.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final com.badlogic.gdx.graphics.Color[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DayNightCycle(box2dLight.RayHandler rayHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns a float representing the time of day.
    void
    Pauses the day/night cycle.
    void
    Resumes the day/night cycle.
    void
    Updates the day/night cycle ambient lighting effect.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DAY_LENGTH

      public static final long DAY_LENGTH
      See Also:
    • keyTimes

      public static final com.badlogic.gdx.graphics.Color[] keyTimes
  • Constructor Details

    • DayNightCycle

      public DayNightCycle(box2dLight.RayHandler rayHandler)
  • Method Details

    • pause

      public void pause()
      Pauses the day/night cycle.
    • resume

      public void resume()
      Resumes the day/night cycle.
    • getTimeOfDay

      public float getTimeOfDay()
      Returns a float representing the time of day. 0.0 is midnight and 1.0 is the next midnight.
      Returns:
      the time of day as a float between 0.0 and 1.0
    • update

      public void update()
      Updates the day/night cycle ambient lighting effect.