Class ConeLightPanningTaskComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.lighting.ConeLightPanningTaskComponent
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.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConeLightPanningTaskComponent
(float degreeStart, float degreeEnd, float angularVelocity) -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.void
dispose()
Called when the component is disposed.Gets the created child lens entityvoid
setAngularAccel
(float angularAccel) void
setAngularVelocity
(float angularVelocity) Set the angular velocity and change max speed based upon new value.void
update()
Called once per frame of the game, and should be used for most component logic.Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
ConeLightPanningTaskComponent
public ConeLightPanningTaskComponent(float degreeStart, float degreeEnd, float angularVelocity)
-
-
Method Details
-
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. -
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. -
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.
-