Package com.csse3200.game.components
Class ConeLightComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.ConeLightComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a ConeLightComponent which can be attached to an entity to enable it to produce light.ConeLightComponent
(float distance) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.ConeLightComponent
(float distance, com.badlogic.gdx.graphics.Color color) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.ConeLightComponent
(float distance, com.badlogic.gdx.graphics.Color color, float directionDegree) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.ConeLightComponent
(float distance, com.badlogic.gdx.graphics.Color color, float directionDegree, float coneDegree) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.ConeLightComponent
(com.badlogic.gdx.graphics.Color color) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Creates the event listener for the light to enable it to be toggled on and offvoid
dispose()
Disposes of the light if the entity is disposedboolean
Determines whether the light is currently onvoid
setColor
(com.badlogic.gdx.graphics.Color color) Sets the color of the lightvoid
setConeDegree
(float coneDegree) Changes the cone degree of the lightvoid
setDirection
(float direction) Changes the direction of the cone lightvoid
setDistance
(float distance) Sets the distance/spread of the lightvoid
Toggles the light between an on and off statevoid
update()
Called every frame draw to ensure that the position of the light is the same as the entityvoid
write
(com.badlogic.gdx.utils.Json json) Writes to the json in order to store the lights stateMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
ConeLightComponent
public ConeLightComponent()Creates a ConeLightComponent which can be attached to an entity to enable it to produce light. -
ConeLightComponent
public ConeLightComponent(float distance) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
distance
- distance/spread of the light
-
ConeLightComponent
public ConeLightComponent(com.badlogic.gdx.graphics.Color color) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
color
- color of the light being created
-
ConeLightComponent
public ConeLightComponent(float distance, com.badlogic.gdx.graphics.Color color) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
distance
- distance/spread of the lightcolor
- color of the light being created
-
ConeLightComponent
public ConeLightComponent(float distance, com.badlogic.gdx.graphics.Color color, float directionDegree) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
distance
- distance/spread of the lightcolor
- color of the light being createddirectionDegree
- direction that the light is pointing in
-
ConeLightComponent
public ConeLightComponent(float distance, com.badlogic.gdx.graphics.Color color, float directionDegree, float coneDegree) Creates an ConeLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
distance
- distance/spread of the lightcolor
- color of the light being createddirectionDegree
- direction that the light is pointing inconeDegree
- size of the cone in degrees
-
-
Method Details
-
create
public void create()Creates the event listener for the light to enable it to be toggled on and off -
setDistance
public void setDistance(float distance) Sets the distance/spread of the light- Parameters:
distance
- distance/spread of the light
-
setColor
public void setColor(com.badlogic.gdx.graphics.Color color) Sets the color of the light- Parameters:
color
- light color
-
toggleLight
public void toggleLight()Toggles the light between an on and off state -
getActive
public boolean getActive()Determines whether the light is currently on- Returns:
- state of the light (on/off)
-
setDirection
public void setDirection(float direction) Changes the direction of the cone light- Parameters:
direction
- direction of the light
-
setConeDegree
public void setConeDegree(float coneDegree) Changes the cone degree of the light- Parameters:
coneDegree
- cone degree of the light
-
update
public void update()Called every frame draw to ensure that the position of the light is the same as the entity -
dispose
public void dispose()Disposes of the light if the entity is disposed -
write
public void write(com.badlogic.gdx.utils.Json json) Writes to the json in order to store the lights state
-