Compare commits

...

3 Commits

5 changed files with 36 additions and 2 deletions

Binary file not shown.

View File

@ -144,6 +144,18 @@ void AEnemyCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
healthComponent->TakeDamage(Hit.GetActor(), CurrentWeapon->GetWeaponProperties()->WeaponDamage, nullptr,
GetController(), this);
}
auto character = Cast<ANakatomiCharacter>(Hit.GetActor());
if (character && character->GetOnDamagedHitNiagaraSystem())
{
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this,
character->GetOnDamagedHitNiagaraSystem(),
Hit.ImpactPoint,
dir.MirrorByVector(Hit.ImpactNormal).Rotation(),
FVector(1),
true);
}
}
auto staticMeshComponent = Hit.GetActor()->GetComponentByClass<UStaticMeshComponent>();

View File

@ -257,6 +257,11 @@ bool ANakatomiCharacter::GetCrouched()
return false;
}
UNiagaraSystem* ANakatomiCharacter::GetOnDamagedHitNiagaraSystem()
{
return OnDamagedHitNiagaraSystem;
}
void ANakatomiCharacter::CalculateHits(TArray<FHitResult>* hits, FVector* dir)
{
}

View File

@ -45,6 +45,9 @@ public:
UPROPERTY(EditDefaultsOnly)
TArray<UAnimMontage*> OnDamagedHitAnimMontages;
UPROPERTY(EditDefaultsOnly)
UNiagaraSystem* OnDamagedHitNiagaraSystem;
protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Meta = (AllowPrivateAccess = "true"))
UNakatomiCMC* NakatomiCMC;
@ -115,6 +118,8 @@ public:
UFUNCTION(BlueprintCallable)
bool GetCrouched();
UNiagaraSystem* GetOnDamagedHitNiagaraSystem();
protected:
virtual void CalculateHits(TArray<FHitResult>* hits, FVector* dir);

View File

@ -406,6 +406,18 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits, FVector dir)
{
healthComponent->TakeDamage(Hit.GetActor(), CurrentWeapon->GetWeaponProperties()->WeaponDamage, nullptr,
GetController(), this);
auto character = Cast<ANakatomiCharacter>(Hit.GetActor());
if (character && character->GetOnDamagedHitNiagaraSystem())
{
UNiagaraFunctionLibrary::SpawnSystemAtLocation(this,
character->GetOnDamagedHitNiagaraSystem(),
Hit.ImpactPoint,
dir.MirrorByVector(Hit.ImpactNormal).Rotation(),
FVector(1),
true);
}
if (!healthComponent->GetIsDead())
{