Package com.csse3200.game.components
Class AuraLightComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.AuraLightComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
- Direct Known Subclasses:
ShipLightComponent
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a AuraLightComponent which can be attached to an entity to enable it to produce light.AuraLightComponent
(float distance) Creates an AuraLightComponent which can be attached to an entity to enable it to produce light.AuraLightComponent
(float distance, com.badlogic.gdx.graphics.Color color) Creates an AuraLightComponent which can be attached to an entity to enable it to produce light.AuraLightComponent
(com.badlogic.gdx.graphics.Color color) Creates an AuraLightComponent 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
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 entityMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
-
Constructor Details
-
AuraLightComponent
public AuraLightComponent()Creates a AuraLightComponent which can be attached to an entity to enable it to produce light. -
AuraLightComponent
public AuraLightComponent(float distance) Creates an AuraLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
distance
- distance/spread of the light
-
AuraLightComponent
public AuraLightComponent(com.badlogic.gdx.graphics.Color color) Creates an AuraLightComponent which can be attached to an entity to enable it to produce light.- Parameters:
color
- color of the light being created
-
AuraLightComponent
public AuraLightComponent(float distance, com.badlogic.gdx.graphics.Color color) Creates an AuraLightComponent 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
-
-
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)
-
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
-