Class LightFactory

java.lang.Object
com.csse3200.game.entities.factories.LightFactory

public class LightFactory extends Object
The light factory is used to create the various light entities and apply the corresponding components to them. The implementation is currently up for change as it has been configured for debugging.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Entity
    createConeLight(int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg)
    Creates a new static cone light entity.
    static Entity
    createRotatingConeLight(int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg, float angularVelDeg)
    Creates a new rotating cone light entity with a fixed angular velocity.
    static Entity
    createSecurityLight(Entity target, short occluderMask, int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg)
    Creates a detecting light that can detect a target entity within the light.

    Methods inherited from class java.lang.Object

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

    • createConeLight

      public static Entity createConeLight(int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg)
      Creates a new static cone light entity.
      Parameters:
      rays - the number of rays (resolution) of the light (I found that 128 works well)
      color - the colour of the light
      distance - the distance the light travels
      directionDeg - the direction the light points in
      coneDeg - the angle width of the cone light
      Returns:
      the cone light entity created
    • createRotatingConeLight

      public static Entity createRotatingConeLight(int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg, float angularVelDeg)
      Creates a new rotating cone light entity with a fixed angular velocity. The light would be fixed in place and pivot on the spot.
      Parameters:
      rays - the number of rays (resolution) of the light
      color - the colour of the light
      distance - the distance the light travels
      directionDeg - the direction the light points in
      coneDeg - the angle width of the cone light
      angularVelDeg - the angular velocity of the rotating light.
      Returns:
      the cone light entity created
    • createSecurityLight

      public static Entity createSecurityLight(Entity target, short occluderMask, int rays, com.badlogic.gdx.graphics.Color color, float distance, float directionDeg, float coneDeg)
      Creates a detecting light that can detect a target entity within the light. The target entity can also hide behind any objects with the same physics layer as the occluderMask. The implementation currently just changed the colour of the light from green to red if detected.
      Parameters:
      target - the target entity to be detected
      occluderMask - the physics layer to block the light
      rays - the number of rays (resolution) of the light
      color - the colour of the light
      distance - the distance the light travels
      directionDeg - the direction the light points in
      coneDeg - the angle width of the cone light
      Returns:
      the cone light entity created