Update Enemy Character for Damage Implementation

This commit is contained in:
MH261677 2023-10-09 14:27:40 +01:00
parent 29b436434b
commit e03c19e421
2 changed files with 5 additions and 3 deletions

Binary file not shown.

View File

@ -91,7 +91,7 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime)
traceEnd = traceStart + (UKismetMathLibrary::GetForwardVector(playerInWorld->GetControlRotation() * GetRecoilPitch(amplitude, recoilTime)));
//UE_LOG(LogTemp, Warning, TEXT("Controller pitch: Pitch: %f Yaw: %f, Roll: %f"), playerInWorld->GetControlRotation().Pitch, playerInWorld->GetControlRotation().Yaw, playerInWorld->GetControlRotation().Roll);
playerInWorld->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime));
UE_LOG(LogTemp, Warning, TEXT("recoilTime: %f"), recoilTime);
//UE_LOG(LogTemp, Warning, TEXT("recoilTime: %f"), recoilTime);
UpdateSamples(amplitude, recoilTime);
}
}
@ -169,6 +169,8 @@ void ABaseWeaponClass::Fire()
bulletCountShoot += 1;
if (outHit.bBlockingHit)
{
UE_LOG(LogTemp, Display, TEXT("Ammo Count: %s"), *outHit.GetActor()->GetName());
if (!Cast<AAICharacter>(outHit.GetActor())) return;
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
}
}