Skip to content

Added delegate when the interaction options are updated #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ void UGBFInteractableComponent::UpdateInteractions( UGBFInteractionOptionsData *
}

InteractionOptionContainer.AddOptions( options_data->Options );
OnInteractionsUpdatedDelegate.Broadcast();
}

void UGBFInteractableComponent::RemoveInteractions()
{
InteractionOptionContainer.ResetOptions();
OnInteractionsUpdatedDelegate.Broadcast();
}

void UGBFInteractableComponent::OnInteractableActorEnteredRadius( AActor * actor )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ class GAMEBASEFRAMEWORK_API UGBFInteractableComponent : public UActorComponent

public:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam( FGBFOnInteractableInteractionRadiusStateChangedDelegate, AActor *, Actor );
DECLARE_DYNAMIC_MULTICAST_DELEGATE( FGBFOnInteractionsUpdatedDelegate );

UGBFInteractableComponent();

FGBFOnInteractableInteractionRadiusStateChangedDelegate & OnInteractableActorEnteredRadius();
FGBFOnInteractableInteractionRadiusStateChangedDelegate & OnInteractableLeftRadius();
FGBFOnInteractionsUpdatedDelegate & OnInteractionsUpdated();

const FGBFInteractionOptionContainer & GetInteractableOptions() const;
bool IsEnabled() const;
Expand Down Expand Up @@ -66,6 +68,9 @@ class GAMEBASEFRAMEWORK_API UGBFInteractableComponent : public UActorComponent
UPROPERTY( BlueprintAssignable, meta = ( AllowPrivateAccess = true ) )
FGBFOnInteractableInteractionRadiusStateChangedDelegate OnInteractableActorLeftRadiusDelegate;

UPROPERTY( BlueprintAssignable, meta = ( AllowPrivateAccess = true ) )
FGBFOnInteractionsUpdatedDelegate OnInteractionsUpdatedDelegate;

UPROPERTY()
TArray< TObjectPtr< AActor > > ActorsInInteractionRadius;
};
Expand Down Expand Up @@ -95,6 +100,11 @@ FORCEINLINE UGBFInteractableComponent::FGBFOnInteractableInteractionRadiusStateC
return OnInteractableActorLeftRadiusDelegate;
}

FORCEINLINE UGBFInteractableComponent::FGBFOnInteractionsUpdatedDelegate & UGBFInteractableComponent::OnInteractionsUpdated()
{
return OnInteractionsUpdatedDelegate;
}

FORCEINLINE bool UGBFInteractableComponent::HasInteractableActorsInRadius() const
{
return !ActorsInInteractionRadius.IsEmpty();
Expand Down