ULimenDialogueSpeakerComponent
Overview
ULimenDialogueSpeakerComponent is an actor component used to manage and play dialogue for entities within the game world. It interacts with the ULimenDialogueSubsystem to handle the registration and playback of dialogue based on the speaker's ID and associated audio components.
Properties
Type | Name | Access | Description |
|---|---|---|---|
FName | SpeakerID | EditAnywhere, BlueprintReadOnly | The unique identifier for the speaker. |
FName | DialogueAudioComponentTag | EditAnywhere, BlueprintReadOnly | The tag used to identify the dialogue audio component on the owner actor. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | BeginPlay() | Called when the component is added to an actor or spawned in the world. Registers the speaker with the subsystem. |
void | EndPlay(const EEndPlayReason::Type EndPlayReason) | Called when the component is removed from an actor or destroyed. Unregisters the speaker from the subsystem. |
UActorComponent* | GetDialogueAudioComponent() const | Retrieves the dialogue audio component associated with the owner actor. If not found, it searches for a component with the specified tag and caches it. |
void | SetSpeakerID(const FName& NewSpeakerID) | Sets the speaker ID. This should be done before registering the speaker to avoid issues with subsystem registration. |
const FName& | GetSpeakerID() const | Returns the current speaker ID. |
UFUNCTION(BlueprintCallable) | PlayDialogue(const UDataTable* InDialogueData, const FDialogueEndEvent OnDialogueEnd) | Plays dialogue using the provided dialogue data table and a callback for when the dialogue ends. |
void | RegisterSpeaker() | Registers the speaker with the |
void | UnRegisterSpeaker() | Unregisters the speaker from the |
Usage & Implementation Notes
The component must be attached to an actor that has a component tagged with
DialogueAudioComponentTagfor audio playback.The
SpeakerIDshould be set before callingRegisterSpeaker()to ensure proper subsystem registration.The component handles caching of the dialogue audio component, which is retrieved from the owner actor's components.