Add CameraShake in Player Character on OnDamaged
This commit is contained in:
parent
b28395bb72
commit
c9c128ba44
@ -77,6 +77,12 @@ void APlayerCharacter::OnDamaged(FDamageInfo damageInfo)
|
||||
{
|
||||
UGameplayStatics::PlaySoundAtLocation(GetWorld(), OnDamagedSound, GetActorLocation());
|
||||
}
|
||||
|
||||
APlayerController* playerController = UGameplayStatics::GetPlayerController(this, 0);
|
||||
if (playerController && CameraShake)
|
||||
{
|
||||
playerController->ClientStartCameraShake(CameraShake);
|
||||
}
|
||||
}
|
||||
|
||||
void APlayerCharacter::OnDeath(FDamageInfo damageInfo)
|
||||
|
@ -32,6 +32,9 @@ public:
|
||||
UPROPERTY(EditAnywhere)
|
||||
UWidgetComponent* HealthBarWidgetComponent;
|
||||
|
||||
UPROPERTY(EditAnywhere)
|
||||
TSubclassOf<UCameraShakeBase> CameraShake;
|
||||
|
||||
APlayerCharacter();
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user