Bugfix Invalid AI Controller

This commit is contained in:
Rafal Swierczek 2024-05-14 04:15:24 +01:00
parent 9e868073f4
commit 52f8aeddb4

View File

@ -77,8 +77,11 @@ void AAICharacter::SetupStimuliSourceComponent()
void AAICharacter::OnDeath()
{
AAI_EnemyController* AIController = Cast<AAI_EnemyController>(GetController());
if (!IsValid(AIController)) return;
UBlackboardComponent* Blackboard = AIController->GetBlackboardComponent();
if (!IsValid(Blackboard)) return;
AEndlessVendettaCharacter* PlayerCharacter = Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn());
if (!IsValid(PlayerCharacter)) return;
if (Blackboard->GetValueAsBool("SeenWithHostilities"))
{
PlayerCharacter->DecrementSeenHostileCount();