[박치영] Knockdown 시스템 완료
parent
cbc4892b39
commit
0efd874aa1
Binary file not shown.
Binary file not shown.
|
@ -146,26 +146,20 @@ float ACombatPlayerCharacter::TakeDamage(float Damage, FDamageEvent const& Damag
|
||||||
{
|
{
|
||||||
float fDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
|
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))
|
if(!IsValid(damageTypeClass))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (DamageEvent.IsOfType(FPointDamageEvent::ClassID))
|
if (DamageEvent.IsOfType(FPointDamageEvent::ClassID))
|
||||||
{
|
{
|
||||||
const FPointDamageEvent* PointDamageEvent = static_cast<const FPointDamageEvent*>(&DamageEvent);
|
const FPointDamageEvent* PointDamageEvent = static_cast<const FPointDamageEvent*>(&DamageEvent);
|
||||||
|
ReceiveDamage(fDamage, PointDamageEvent, damageTypeClass, EventInstigator);
|
||||||
|
|
||||||
//스텟 관련 처리
|
}
|
||||||
StatsComponent->TakeDamageOnStat(Damage);
|
else if(DamageEvent.IsOfType(FRadialDamageEvent::ClassID))
|
||||||
|
{
|
||||||
//앞에서 맞았는지 뒤에서 맞았는지 판별
|
const FRadialDamageEvent* RadialDamageEvent = static_cast<const FRadialDamageEvent*>(&DamageEvent);
|
||||||
bHitFront = UKismetMathLibrary::InRange_FloatFloat(this->GetDotProductTo(EventInstigator->GetPawn()), -0.1f, 1.f);
|
ReceiveDamage(fDamage, RadialDamageEvent, damageTypeClass, EventInstigator);
|
||||||
LastHitInfo = PointDamageEvent->HitInfo;
|
|
||||||
|
|
||||||
//play sound, effect
|
|
||||||
ApplyImpactEffect(damageTypeClass->DamageType);
|
|
||||||
|
|
||||||
if (CanReceiveHitReaction())
|
|
||||||
ApplyHitReaction(damageTypeClass->DamageType);
|
|
||||||
}
|
}
|
||||||
return fDamage;
|
return fDamage;
|
||||||
}
|
}
|
||||||
|
@ -722,6 +716,38 @@ void ACombatPlayerCharacter::ApplyImpactEffect(EDamageType InDamageType)
|
||||||
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), HitEmitter, LastHitInfo.Location);
|
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()
|
void ACombatPlayerCharacter::RotateToTarget()
|
||||||
{
|
{
|
||||||
RotateToTargetTimeLineComponent->PlayFromStart();
|
RotateToTargetTimeLineComponent->PlayFromStart();
|
||||||
|
|
|
@ -163,6 +163,9 @@ private:
|
||||||
void ApplyHitReaction(EDamageType InDamageType);
|
void ApplyHitReaction(EDamageType InDamageType);
|
||||||
void ApplyImpactEffect(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
|
//Timeline
|
||||||
void RotateToTarget();
|
void RotateToTarget();
|
||||||
void StopRotateToTarget();
|
void StopRotateToTarget();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "AttackDamageType.generated.h"
|
#include "AttackDamageType.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 다른 DamageType 을 처리하고 싶으면 해당 Class 를 상속해서 EDamageType를 다르게 처리할 것
|
* 다른 DamageType 을 처리하고 싶으면 해당 Class와 동일하게 UDamageType를 상속해서 만들 것
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class D1_API UAttackDamageType : public UDamageType
|
class D1_API UAttackDamageType : public UDamageType
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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();
|
||||||
|
};
|
Loading…
Reference in New Issue