[박치영] Knockdown 시스템 완료

main
PCYPC\pcy35 2023-11-08 21:17:23 +09:00
parent cbc4892b39
commit 0efd874aa1
7 changed files with 72 additions and 15 deletions

View File

@ -146,26 +146,20 @@ float ACombatPlayerCharacter::TakeDamage(float Damage, FDamageEvent const& Damag
{
float fDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
UAttackDamageType* damageTypeClass = Cast<UAttackDamageType>(DamageEvent.DamageTypeClass->GetDefaultObject());
const UAttackDamageType* damageTypeClass = Cast<UAttackDamageType>(DamageEvent.DamageTypeClass->GetDefaultObject());
if(!IsValid(damageTypeClass))
return false;
if (DamageEvent.IsOfType(FPointDamageEvent::ClassID))
{
const FPointDamageEvent* PointDamageEvent = static_cast<const FPointDamageEvent*>(&DamageEvent);
//스텟 관련 처리
StatsComponent->TakeDamageOnStat(Damage);
//앞에서 맞았는지 뒤에서 맞았는지 판별
bHitFront = UKismetMathLibrary::InRange_FloatFloat(this->GetDotProductTo(EventInstigator->GetPawn()), -0.1f, 1.f);
LastHitInfo = PointDamageEvent->HitInfo;
//play sound, effect
ApplyImpactEffect(damageTypeClass->DamageType);
ReceiveDamage(fDamage, PointDamageEvent, damageTypeClass, EventInstigator);
if (CanReceiveHitReaction())
ApplyHitReaction(damageTypeClass->DamageType);
}
else if(DamageEvent.IsOfType(FRadialDamageEvent::ClassID))
{
const FRadialDamageEvent* RadialDamageEvent = static_cast<const FRadialDamageEvent*>(&DamageEvent);
ReceiveDamage(fDamage, RadialDamageEvent, damageTypeClass, EventInstigator);
}
return fDamage;
}
@ -722,6 +716,38 @@ void ACombatPlayerCharacter::ApplyImpactEffect(EDamageType InDamageType)
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), HitEmitter, LastHitInfo.Location);
}
void ACombatPlayerCharacter::ReceiveDamage(float Damage, const FPointDamageEvent* pointDamageEvent, const UAttackDamageType* damageTypeClass, AController* eventInstigator)
{
//스텟 관련 처리
StatsComponent->TakeDamageOnStat(Damage);
//앞에서 맞았는지 뒤에서 맞았는지 판별
bHitFront = UKismetMathLibrary::InRange_FloatFloat(this->GetDotProductTo(eventInstigator->GetPawn()), -0.1f, 1.f);
LastHitInfo = pointDamageEvent->HitInfo;
//play sound, effect
ApplyImpactEffect(damageTypeClass->DamageType);
if (CanReceiveHitReaction())
ApplyHitReaction(damageTypeClass->DamageType);
}
void ACombatPlayerCharacter::ReceiveDamage(float Damage, const FRadialDamageEvent* radialDamageEvent, const UAttackDamageType* damageTypeClass, AController* eventInstigator)
{
//스텟 관련 처리
StatsComponent->TakeDamageOnStat(Damage);
//앞에서 맞았는지 뒤에서 맞았는지 판별
bHitFront = UKismetMathLibrary::InRange_FloatFloat(this->GetDotProductTo(eventInstigator->GetPawn()), -0.1f, 1.f);
LastHitInfo = radialDamageEvent->ComponentHits[0];
//play sound, effect
ApplyImpactEffect(damageTypeClass->DamageType);
if (CanReceiveHitReaction())
ApplyHitReaction(damageTypeClass->DamageType);
}
void ACombatPlayerCharacter::RotateToTarget()
{
RotateToTargetTimeLineComponent->PlayFromStart();

View File

@ -162,7 +162,10 @@ private:
void SprintStaminaCost();
void ApplyHitReaction(EDamageType InDamageType);
void ApplyImpactEffect(EDamageType InDamageType);
void ReceiveDamage(float Damage, const FPointDamageEvent* pointDamageEvent, const class UAttackDamageType* damageTypeClass, AController* eventInstigator);
void ReceiveDamage(float Damage, const FRadialDamageEvent* radialDamageEvent, const class UAttackDamageType* damageTypeClass, AController* eventInstigator);
//Timeline
void RotateToTarget();
void StopRotateToTarget();

View File

@ -8,7 +8,7 @@
#include "AttackDamageType.generated.h"
/**
* DamageType Class EDamageType
* DamageType Class UDamageType
*/
UCLASS()
class D1_API UAttackDamageType : public UDamageType

View File

@ -0,0 +1,9 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "DamageType/KnockdownAttackDamageType.h"
UKnockdownAttackDamageType::UKnockdownAttackDamageType()
{
DamageType = EDamageType::KnockdownDamage;
}

View File

@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DamageType/AttackDamageType.h"
#include "KnockdownAttackDamageType.generated.h"
/**
*
*/
UCLASS()
class D1_API UKnockdownAttackDamageType : public UAttackDamageType
{
GENERATED_BODY()
public:
UKnockdownAttackDamageType();
};