Class LightFactory
java.lang.Object
com.csse3200.game.entities.factories.LightFactory
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 TypeMethodDescriptionstatic 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.
-
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 lightdistance
- the distance the light travelsdirectionDeg
- the direction the light points inconeDeg
- 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 lightcolor
- the colour of the lightdistance
- the distance the light travelsdirectionDeg
- the direction the light points inconeDeg
- the angle width of the cone lightangularVelDeg
- 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 detectedoccluderMask
- the physics layer to block the lightrays
- the number of rays (resolution) of the lightcolor
- the colour of the lightdistance
- the distance the light travelsdirectionDeg
- the direction the light points inconeDeg
- the angle width of the cone light- Returns:
- the cone light entity created
-