[박치영] 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);
|
||||
|
||||
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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "AttackDamageType.generated.h"
|
||||
|
||||
/**
|
||||
* 다른 DamageType 을 처리하고 싶으면 해당 Class 를 상속해서 EDamageType를 다르게 처리할 것
|
||||
* 다른 DamageType 을 처리하고 싶으면 해당 Class와 동일하게 UDamageType를 상속해서 만들 것
|
||||
*/
|
||||
UCLASS()
|
||||
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