ALimenFlashlight
Overview
ALimenFlashlight is a subclass of ALimenTool that manages a spotlight and a cone trace component to simulate a flashlight effect. It handles activation, deactivation, and collision detection with actors within its cone of light.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TObjectPtr | Light | EditDefaultsOnly | The spotlight component that emits the light. |
TObjectPtr< ULimenConeTraceComponent > | ConeTrace | EditDefaultsOnly | The cone trace component used to detect actors within the flashlight's range. |
Functions
Return Type | Signature | Description |
|---|---|---|
GetConeTraceComponent() const | Returns a pointer to the | |
USpotLightComponent* | GetLight() const | Returns a pointer to the |
void | ToolActivated() override | Called when the tool is activated. Activates the light and deactivates the cone trace component. |
void | ToolDeactivated() override | Called when the tool is deactivated. Deactivates both the light and the cone trace component. |
UFUNCTION(BlueprintImplementableEvent) | OnActorLitUpdate(AActor* Actor, const bool bIsInside) | A Blueprint-implementable event that gets called when an actor enters or exits the flashlight's cone of light. |
Usage & Implementation Notes
Threading Constraints: This class is designed to be used in the game thread.
Replication Requirements: None.
Memory Lifetime Management: The components (
LightandConeTrace) are created as default subobjects, ensuring they are properly managed by Unreal Engine's garbage collection system.Initialization Dependencies: The cone trace component listens for collision updates in its constructor.