Class ConeLightPanningTaskComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.lighting.ConeLightPanningTaskComponent

public class ConeLightPanningTaskComponent extends Component
This component is responsible for the movement of the security camera light. It has two main tasks, panning mode when the target isn't detected and tracking mode when the target is. In panning mode it moves at a constant angular velocity defined at creation and within the bounds defined. Once in tracking mode it moves towards the target gaining speed based on a defined constant acceleration.

This component also spawns in a child entity for the camera lens. This allows the lens to move dynamically and not be defined to a set animation. The component also handles the disposal of the child lens.

  • Constructor Details

    • ConeLightPanningTaskComponent

      public ConeLightPanningTaskComponent(float degreeStart, float degreeEnd, float angularVelocity)
  • Method Details

    • getCameraLens

      public Entity getCameraLens()
      Gets the created child lens entity
      Returns:
      The lens entity
    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class Component
    • update

      public void update()
      Description copied from class: Component
      Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
      Overrides:
      update in class Component
    • setAngularVelocity

      public void setAngularVelocity(float angularVelocity)
      Set the angular velocity and change max speed based upon new value.
      Parameters:
      angularVelocity - New angular velocity
    • setAngularAccel

      public void setAngularAccel(float angularAccel)
    • dispose

      public void dispose()
      Description copied from class: Component
      Called when the component is disposed. Dispose of any internal resources here.
      Overrides:
      dispose in class Component