Add Interactable Actor Component interaction on weapon hit

This commit is contained in:
Louis Hobbs 2023-05-29 01:36:59 +01:00
parent 7256afd8bf
commit 705d46820c
2 changed files with 6 additions and 0 deletions

View File

@ -279,6 +279,11 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits)
if (Hit.GetActor()) if (Hit.GetActor())
{ {
if (auto interactableComponent = Hit.GetActor()->GetComponentByClass<UInteractableComponent>())
{
interactableComponent->Interact();
}
if (Hit.GetActor()->ActorHasTag("Enemy")) if (Hit.GetActor()->ActorHasTag("Enemy"))
{ {
// TODO: Do thing // TODO: Do thing

View File

@ -13,6 +13,7 @@
#include "Engine/DamageEvents.h" #include "Engine/DamageEvents.h"
#include "Blueprint/UserWidget.h" #include "Blueprint/UserWidget.h"
#include "Perception/AIPerceptionStimuliSourceComponent.h" #include "Perception/AIPerceptionStimuliSourceComponent.h"
#include "InteractableComponent.h"
#include "PlayerCharacter.generated.h" #include "PlayerCharacter.generated.h"
class UInputAction; class UInputAction;