Filter Hits by Actor Tag

This commit is contained in:
Louis Hobbs 2023-01-16 23:14:03 +00:00
parent 26d9daf73d
commit 495e08ec74
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "EnhancedInputSubsystems.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "InputMappingContext.h"
#include "Destructable.h"
#define COLLISION_WEAPON ECC_GameTraceChannel1
@ -234,6 +235,17 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
DrawDebugLine(GetWorld(), TraceStart, Result.ImpactPoint, FColor::Blue, true, 500, 0U, 0);
// TODO: Handle hits in a meaningful way
if (Result.GetActor()->ActorHasTag(FName("Destructable")))
{
// TODO: Do thing
auto destructable = Cast<ADestructable>(Result.GetActor());
destructable->Destruct();
}
else if (Result.GetActor()->ActorHasTag(FName("Enemy")))
{
// TODO: Do thing
}
}
}
}