Compare commits

...

2 Commits

Author SHA1 Message Date
baz d6770f8d4b Add soundeffect to Shotgun weapon 2024-03-06 02:05:08 +00:00
baz baf54dd6f5 Fix minor bugs 2024-03-06 02:04:57 +00:00
3 changed files with 14 additions and 9 deletions

BIN
Content/Weapons/Shotgun/Shotgun.uasset (Stored with Git LFS)

Binary file not shown.

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

@ -275,6 +275,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);
if (OnDamagedHitAnimMontages[randomAnimMontage] != nullptr) if (OnDamagedHitAnimMontages[randomAnimMontage] != nullptr)
@ -282,6 +284,7 @@ void ANakatomiCharacter::OnDamaged()
//TODO: Disable movement while playing animation montage //TODO: Disable movement while playing animation montage
// PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]); // PlayAnimMontage(OnDamagedHitAnimMontages[randomAnimMontage]);
} }
}
} }
void ANakatomiCharacter::OnDeath() void ANakatomiCharacter::OnDeath()