Fix minor bugs

This commit is contained in:
baz 2024-03-06 02:04:57 +00:00
parent 95a7b28db2
commit baf54dd6f5
2 changed files with 12 additions and 7 deletions

View File

@ -142,7 +142,9 @@ void AEnemyCharacter::OnDamaged()
{ {
Super::OnDamaged(); Super::OnDamaged();
AEnemyAIController* controller = Cast<AEnemyAIController>(GetController()); if (AEnemyAIController* controller = Cast<AEnemyAIController>(GetController()))
{
controller->GetBlackboardComponent()->SetValueAsFloat("CurrentHealth", GetHealthComponent()->GetCurrentHealth()); controller->GetBlackboardComponent()->SetValueAsFloat("CurrentHealth", GetHealthComponent()->GetCurrentHealth());
} }
}

View File

@ -274,6 +274,8 @@ void ANakatomiCharacter::PlayOnFireAnimations()
} }
void ANakatomiCharacter::OnDamaged() void ANakatomiCharacter::OnDamaged()
{
if (OnDamagedHitAnimMontages.Num() > 0)
{ {
int32 randomAnimMontage = FMath::RandRange(0,OnDamagedHitAnimMontages.Num()-1); int32 randomAnimMontage = FMath::RandRange(0,OnDamagedHitAnimMontages.Num()-1);
@ -283,6 +285,7 @@ void ANakatomiCharacter::OnDamaged()
// PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]); // PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]);
} }
} }
}
void ANakatomiCharacter::OnDeath() void ANakatomiCharacter::OnDeath()
{ {