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

public class AuraLightComponent extends Component
  • Field Summary

    Fields inherited from class com.csse3200.game.components.Component

    enabled, entity
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates 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 Type
    Method
    Description
    void
    Creates the event listener for the light to enable it to be toggled on and off
    void
    Disposes of the light if the entity is disposed
    boolean
    Determines whether the light is currently on
    void
    setColor(com.badlogic.gdx.graphics.Color color)
    Sets the color of the light
    void
    setDistance(float distance)
    Sets the distance/spread of the light
    void
    Toggles the light between an on and off state
    void
    Called every frame draw to ensure that the position of the light is the same as the entity

    Methods inherited from class com.csse3200.game.components.Component

    earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 light
      color - 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
      Overrides:
      create in class Component
    • 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
      Overrides:
      update in class Component
    • dispose

      public void dispose()
      Disposes of the light if the entity is disposed
      Overrides:
      dispose in class Component