[박치영] 구조 변경 리팩토링
parent
d749211174
commit
4144aaa60a
|
@ -107,6 +107,8 @@ ManualIPAddress=
|
||||||
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
||||||
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Interactable")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Interactable")
|
||||||
|
+EditProfiles=(Name="Pawn",CustomResponses=((Channel="Camera",Response=ECR_Ignore)))
|
||||||
|
+EditProfiles=(Name="CharacterMesh",CustomResponses=((Channel="Camera",Response=ECR_Ignore)))
|
||||||
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
||||||
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
||||||
-ProfileRedirects=(OldName="StaticMeshComponent",NewName="BlockAllDynamic")
|
-ProfileRedirects=(OldName="StaticMeshComponent",NewName="BlockAllDynamic")
|
||||||
|
@ -126,18 +128,21 @@ ManualIPAddress=
|
||||||
+CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
|
+CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
|
||||||
+CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")
|
+CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")
|
||||||
|
|
||||||
|
|
||||||
[CoreRedirects]
|
[CoreRedirects]
|
||||||
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.EnableCollision",NewName="/Script/D1.CollisionComponent.ActivateCollision")
|
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.EnableCollision",NewName="/Script/D1.CollisionComponent.ActivateCollision")
|
||||||
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.DisableCollision",NewName="/Script/D1.CollisionComponent.DeactivateCollision")
|
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.DisableCollision",NewName="/Script/D1.CollisionComponent.DeactivateCollision")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.BaseDualWeapon.RightFoot",NewName="/Script/D1.BaseDualWeapon.RightFootCollisionComponent")
|
+PropertyRedirects=(OldName="/Script/D1.BaseDualWeapon.RightFoot",NewName="/Script/D1.BaseDualWeapon.RightFootCollisionComponent")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatCharacter.ToogleLockOnAction",NewName="/Script/D1.CombatCharacter.ToggleLockOnAction")
|
+PropertyRedirects=(OldName="/Script/D1.CombatCharacter.ToogleLockOnAction",NewName="/Script/D1.CombatPlayerCharacter.ToggleLockOnAction")
|
||||||
+ClassRedirects=(OldName="/Script/D1.UI_LockOnComponent",NewName="/Script/D1.LockOnWidgetComponent")
|
+ClassRedirects=(OldName="/Script/D1.UI_LockOnComponent",NewName="/Script/D1.LockOnWidgetComponent")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.MasterAI.TargetingWidget",NewName="/Script/D1.MasterAI.TargetingWidgetComponent")
|
+PropertyRedirects=(OldName="/Script/D1.MasterAI.TargetingWidget",NewName="/Script/D1.MasterAI.TargetingWidgetComponent")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.HumanoidEnemy.HealthBar",NewName="/Script/D1.HumanoidEnemy.HealthBarComponent")
|
+PropertyRedirects=(OldName="/Script/D1.HumanoidEnemy.HealthBar",NewName="/Script/D1.HumanoidEnemy.HealthBarComponent")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.T_FindNextPatrolPoint.TargetLocation",NewName="/Script/D1.T_FindNextPatrolPoint.BlackboardKey_TargetLocation")
|
+PropertyRedirects=(OldName="/Script/D1.T_FindNextPatrolPoint.TargetLocation",NewName="/Script/D1.T_FindNextPatrolPoint.BlackboardKey_TargetLocation")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.T_FindNextPatrolPoint.PatrolIndex",NewName="/Script/D1.T_FindNextPatrolPoint.BlackboardKey_PatrolIndex")
|
+PropertyRedirects=(OldName="/Script/D1.T_FindNextPatrolPoint.PatrolIndex",NewName="/Script/D1.T_FindNextPatrolPoint.BlackboardKey_PatrolIndex")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.CombatCharacter.ToggleCombatAction",NewName="/Script/D1.CombatCharacter.ToggleCombatInputAction")
|
+PropertyRedirects=(OldName="/Script/D1.CombatCharacter.ToggleCombatAction",NewName="/Script/D1.CombatPlayerCharacter.ToggleCombatInputAction")
|
||||||
+FunctionRedirects=(OldName="/Script/D1.BaseWeapon.ToggleCombat",NewName="/Script/D1.BaseWeapon.ToggleWeaponCombat")
|
+FunctionRedirects=(OldName="/Script/D1.BaseWeapon.ToggleCombat",NewName="/Script/D1.BaseWeapon.ToggleWeaponCombat")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.S_UpdateBehavior.AttackingRange",NewName="/Script/D1.S_UpdateBehavior.TotalAttackingDistance")
|
+PropertyRedirects=(OldName="/Script/D1.S_UpdateBehavior.AttackingRange",NewName="/Script/D1.S_UpdateBehavior.TotalAttackingDistance")
|
||||||
+PropertyRedirects=(OldName="/Script/D1.S_UpdateBehavior.TotalAttackingDistanceRange",NewName="/Script/D1.S_UpdateBehavior.TotalAttackingDistance")
|
+PropertyRedirects=(OldName="/Script/D1.S_UpdateBehavior.TotalAttackingDistanceRange",NewName="/Script/D1.S_UpdateBehavior.TotalAttackingDistance")
|
||||||
|
+ClassRedirects=(OldName="/Script/D1.CombatCharacter",NewName="/Script/D1.CombatPlayerCharacter")
|
||||||
|
+FunctionRedirects=(OldName="/Script/D1.ICombatInterface.PerformCombatAction",NewName="/Script/D1.ICombatInterface.PerformAction")
|
||||||
|
+FunctionRedirects=(OldName="/Script/D1.ICombatInterface.PerformCombatAttack",NewName="/Script/D1.ICombatInterface.PerformAttack")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -19,7 +19,7 @@ EBTNodeResult::Type UT_PerformAction::ExecuteTask(UBehaviorTreeComponent& OwnerC
|
||||||
if(!CombatInterface)
|
if(!CombatInterface)
|
||||||
return EBTNodeResult::Failed;
|
return EBTNodeResult::Failed;
|
||||||
|
|
||||||
float actionDuration = CombatInterface->PerformCombatAction(ActionTag, StateTag, MontageIndex, RandomIndex);
|
float actionDuration = CombatInterface->PerformAction(ActionTag, StateTag, MontageIndex, RandomIndex);
|
||||||
actionDuration += ActionDurationModifier;
|
actionDuration += ActionDurationModifier;
|
||||||
FTimerHandle ActionTimer;
|
FTimerHandle ActionTimer;
|
||||||
GetWorld()->GetTimerManager().SetTimer(ActionTimer, FTimerDelegate::CreateLambda([&]()
|
GetWorld()->GetTimerManager().SetTimer(ActionTimer, FTimerDelegate::CreateLambda([&]()
|
||||||
|
|
|
@ -19,7 +19,7 @@ EBTNodeResult::Type UT_PerformAttack::ExecuteTask(UBehaviorTreeComponent& OwnerC
|
||||||
if(!CombatInterface)
|
if(!CombatInterface)
|
||||||
return EBTNodeResult::Failed;
|
return EBTNodeResult::Failed;
|
||||||
|
|
||||||
float actionDuration = CombatInterface->PerformCombatAttack(AttackTypeTag, AttackIndex, RandomIndex);
|
float actionDuration = CombatInterface->PerformAttack(AttackTypeTag, AttackIndex, RandomIndex);
|
||||||
actionDuration += ActionDurationModifier;
|
actionDuration += ActionDurationModifier;
|
||||||
FTimerHandle ActionTimer;
|
FTimerHandle ActionTimer;
|
||||||
GetWorld()->GetTimerManager().SetTimer(ActionTimer, FTimerDelegate::CreateLambda([&]()
|
GetWorld()->GetTimerManager().SetTimer(ActionTimer, FTimerDelegate::CreateLambda([&]()
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "Components/CombatComponent.h"
|
#include "Components/CombatComponent.h"
|
||||||
#include "DamageType/AttackDamageType.h"
|
#include "DamageType/AttackDamageType.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "UI/UI_BossHealth.h"
|
|
||||||
#include "UI/UI_HealthBar.h"
|
#include "UI/UI_HealthBar.h"
|
||||||
|
|
||||||
ABossEnemy::ABossEnemy()
|
ABossEnemy::ABossEnemy()
|
||||||
|
|
|
@ -48,9 +48,5 @@ private:
|
||||||
UPROPERTY(EditAnywhere, Blueprintable, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, Blueprintable, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
||||||
FName WeaponHandSocketName;
|
FName WeaponHandSocketName;
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
||||||
TObjectPtr<class UUI_BossHealth> BossHealthWidget;
|
TObjectPtr<class UUserWidget> BossHealthWidget;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
|
||||||
TSubclassOf<class UUI_BossHealth> BossHealthClass;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -195,14 +195,7 @@ void AMasterAI::DeactivateCollision_Implementation(ECollisionPart CollisionPart)
|
||||||
MainWeaponCollisionComponent->DeactivateCollision();
|
MainWeaponCollisionComponent->DeactivateCollision();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMasterAI::ToggleCombat_Implementation()
|
float AMasterAI::PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex)
|
||||||
{
|
|
||||||
if (!IsValid(CombatComponent))
|
|
||||||
return;
|
|
||||||
CombatComponent->SetCombatEnabled(!CombatComponent->GetCombatEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
float AMasterAI::PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex)
|
|
||||||
{
|
{
|
||||||
TArray<UAnimMontage*> montages = GetActionMontage(ActionTag);
|
TArray<UAnimMontage*> montages = GetActionMontage(ActionTag);
|
||||||
int32 montageIdx = MontageIndex;
|
int32 montageIdx = MontageIndex;
|
||||||
|
@ -232,7 +225,7 @@ float AMasterAI::PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateT
|
||||||
return actionDuration;
|
return actionDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
float AMasterAI::PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
float AMasterAI::PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
||||||
{
|
{
|
||||||
TArray<UAnimMontage*> montages = GetActionMontage(AttackType);
|
TArray<UAnimMontage*> montages = GetActionMontage(AttackType);
|
||||||
int32 attackIdx = AttackIndex;
|
int32 attackIdx = AttackIndex;
|
||||||
|
@ -353,7 +346,7 @@ void AMasterAI::AttackEvent()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CombatComponent->GetCombatEnabled())
|
if (CombatComponent->GetCombatEnabled())
|
||||||
PerformCombatAttack(GetDesiredAttackType(), CombatComponent->GetAttackCount(), false);
|
PerformAttack(GetDesiredAttackType(), CombatComponent->GetAttackCount(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMasterAI::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
void AMasterAI::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
||||||
|
|
|
@ -63,13 +63,10 @@ public:
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
void DeactivateCollision(ECollisionPart CollisionPart);
|
void DeactivateCollision(ECollisionPart CollisionPart);
|
||||||
virtual void DeactivateCollision_Implementation(ECollisionPart CollisionPart) override;
|
virtual void DeactivateCollision_Implementation(ECollisionPart CollisionPart) override;
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
|
||||||
void ToggleCombat();
|
|
||||||
virtual void ToggleCombat_Implementation() override;
|
|
||||||
|
|
||||||
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
||||||
virtual float PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex);
|
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex);
|
||||||
virtual float PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex);
|
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex);
|
||||||
|
|
||||||
// Inherited via ITargetingInterface
|
// Inherited via ITargetingInterface
|
||||||
virtual bool CanBeTargeted() override;
|
virtual bool CanBeTargeted() override;
|
||||||
|
|
|
@ -51,6 +51,8 @@ void ABaseWeapon::OnEquipped()
|
||||||
if (!owner)
|
if (!owner)
|
||||||
return;
|
return;
|
||||||
CombatComponent = owner->GetComponentByClass<UCombatComponent>();
|
CombatComponent = owner->GetComponentByClass<UCombatComponent>();
|
||||||
|
CombatComponent->OnCombatToggled.AddUObject(this, &ABaseWeapon::ToggleWeaponCombat);
|
||||||
|
|
||||||
OwnerStateManager = owner->GetComponentByClass<UStateManagerComponent>();
|
OwnerStateManager = owner->GetComponentByClass<UStateManagerComponent>();
|
||||||
|
|
||||||
if (CombatComponent->GetCombatEnabled())
|
if (CombatComponent->GetCombatEnabled())
|
||||||
|
@ -117,10 +119,6 @@ void ABaseWeapon::DeactivateCollision(ECollisionPart CollsionPart)
|
||||||
|
|
||||||
void ABaseWeapon::ToggleWeaponCombat(bool EnableCombat)
|
void ABaseWeapon::ToggleWeaponCombat(bool EnableCombat)
|
||||||
{
|
{
|
||||||
if(!CombatComponent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CombatComponent->SetCombatEnabled(EnableCombat);
|
|
||||||
if(EnableCombat)
|
if(EnableCombat)
|
||||||
AttachActor(HandSocketName);
|
AttachActor(HandSocketName);
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "CombatCharacter.h"
|
#include "CombatPlayerCharacter.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "Components/InputComponent.h"
|
#include "Components/InputComponent.h"
|
||||||
|
@ -16,7 +16,6 @@
|
||||||
#include "Definitions/CombatGameplayTags.h"
|
#include "Definitions/CombatGameplayTags.h"
|
||||||
#include "Engine/DamageEvents.h"
|
#include "Engine/DamageEvents.h"
|
||||||
#include "NiagaraFunctionLibrary.h"
|
#include "NiagaraFunctionLibrary.h"
|
||||||
#include "NiagaraComponent.h"
|
|
||||||
#include "DamageType/AttackDamageType.h"
|
#include "DamageType/AttackDamageType.h"
|
||||||
#include "Kismet/KismetSystemLibrary.h"
|
#include "Kismet/KismetSystemLibrary.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
@ -25,7 +24,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// ACombatCharacter
|
// ACombatCharacter
|
||||||
|
|
||||||
ACombatCharacter::ACombatCharacter()
|
ACombatPlayerCharacter::ACombatPlayerCharacter()
|
||||||
{
|
{
|
||||||
// Set size for collision capsule
|
// Set size for collision capsule
|
||||||
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
|
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
|
||||||
|
@ -70,19 +69,24 @@ ACombatCharacter::ACombatCharacter()
|
||||||
|
|
||||||
// Setting CombatComponent
|
// Setting CombatComponent
|
||||||
CombatComponent = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
CombatComponent = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
||||||
CombatComponent->OnCombatToggled.AddUObject(this, &ACombatCharacter::CharacterCombatToggled);
|
CombatComponent->OnCombatToggled.AddUObject(this, &ACombatPlayerCharacter::CharacterCombatToggled);
|
||||||
|
|
||||||
// Setting StateManagerComponent
|
// Setting StateManagerComponent
|
||||||
StateManagerComponent = CreateDefaultSubobject<UStateManagerComponent>(TEXT("StateManagerComponent"));
|
StateManagerComponent = CreateDefaultSubobject<UStateManagerComponent>(TEXT("StateManagerComponent"));
|
||||||
StateManagerComponent->OnStateBegin.AddUObject(this, &ACombatCharacter::CharacterStateBegin);
|
StateManagerComponent->OnStateBegin.AddUObject(this, &ACombatPlayerCharacter::CharacterStateBegin);
|
||||||
StateManagerComponent->OnStateEnd.AddUObject(this, &ACombatCharacter::CharacterStateEnd);
|
StateManagerComponent->OnStateEnd.AddUObject(this, &ACombatPlayerCharacter::CharacterStateEnd);
|
||||||
StateManagerComponent->OnActionBegin.AddUObject(this, &ACombatCharacter::CharacterActionBegin);
|
|
||||||
StateManagerComponent->OnActionEnd.AddUObject(this, &ACombatCharacter::CharacterActionEnd);
|
|
||||||
|
|
||||||
// Setting StatsComponent
|
// Setting StatsComponent
|
||||||
StatsComponent = CreateDefaultSubobject<UStatsComponent>(TEXT("StatsComponent"));
|
StatsComponent = CreateDefaultSubobject<UStatsComponent>(TEXT("StatsComponent"));
|
||||||
StatsComponent->OnCurrentStatValueUpdated.AddUObject(this, &ACombatCharacter::CharacterCurrentStatValueUpdated);
|
StatsComponent->OnCurrentStatValueUpdated.AddUObject(this, &ACombatPlayerCharacter::CharacterCurrentStatValueUpdated);
|
||||||
|
StatsComponent->SetBaseStatValue(EStats::Health, 100.f);
|
||||||
|
StatsComponent->SetMaxStatValue(EStats::Health, 100.f);
|
||||||
|
StatsComponent->SetBaseStatValue(EStats::Stamina, 100.f);
|
||||||
|
StatsComponent->SetMaxStatValue(EStats::Stamina, 100.f);
|
||||||
|
StatsComponent->SetBaseStatValue(EStats::Armor, 0.f);
|
||||||
|
StatsComponent->SetMaxStatValue(EStats::Armor, 100.f);
|
||||||
|
StatsComponent->InitializeStats();
|
||||||
|
|
||||||
//Setting TargetComponent
|
//Setting TargetComponent
|
||||||
TargetingComponent = CreateDefaultSubobject<UTargetingComponent>(TEXT("TargetingComponent"));
|
TargetingComponent = CreateDefaultSubobject<UTargetingComponent>(TEXT("TargetingComponent"));
|
||||||
|
|
||||||
|
@ -100,7 +104,7 @@ ACombatCharacter::ACombatCharacter()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::BeginPlay()
|
void ACombatPlayerCharacter::BeginPlay()
|
||||||
{
|
{
|
||||||
// Call the base class
|
// Call the base class
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
@ -121,11 +125,9 @@ void ACombatCharacter::BeginPlay()
|
||||||
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Weapon, &GetActorTransform(), spawnParam));
|
ABaseEquippable* SpawnItem = Cast<ABaseEquippable>(GetWorld()->SpawnActor(Weapon, &GetActorTransform(), spawnParam));
|
||||||
if (SpawnItem)
|
if (SpawnItem)
|
||||||
SpawnItem->OnEquipped();
|
SpawnItem->OnEquipped();
|
||||||
|
|
||||||
StatsComponent->InitializeStats();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float ACombatCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
|
float ACombatPlayerCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
|
||||||
{
|
{
|
||||||
float fDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
|
float fDamage = Super::TakeDamage(Damage, DamageEvent, EventInstigator, DamageCauser);
|
||||||
|
|
||||||
|
@ -153,7 +155,7 @@ float ACombatCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent
|
||||||
return fDamage;
|
return fDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ContinueAttack_Implementation()
|
void ACombatPlayerCharacter::ContinueAttack_Implementation()
|
||||||
{
|
{
|
||||||
if (CombatComponent->GetIsAttackSaved())
|
if (CombatComponent->GetIsAttackSaved())
|
||||||
{
|
{
|
||||||
|
@ -164,19 +166,19 @@ void ACombatCharacter::ContinueAttack_Implementation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ResetAttack_Implementation()
|
void ACombatPlayerCharacter::ResetAttack_Implementation()
|
||||||
{
|
{
|
||||||
CombatComponent->ResetAttack();
|
CombatComponent->ResetAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ResetCombat_Implementation()
|
void ACombatPlayerCharacter::ResetCombat_Implementation()
|
||||||
{
|
{
|
||||||
CombatComponent->ResetAttack();
|
CombatComponent->ResetAttack();
|
||||||
StateManagerComponent->ResetState();
|
StateManagerComponent->ResetState();
|
||||||
StateManagerComponent->SetCurrentAction(FGameplayTag::EmptyTag);
|
StateManagerComponent->SetCurrentAction(FGameplayTag::EmptyTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
FRotator ACombatCharacter::GetDesiredRotation_Implementation()
|
FRotator ACombatPlayerCharacter::GetDesiredRotation_Implementation()
|
||||||
{
|
{
|
||||||
FVector InputVector = GetCharacterMovement()->GetLastInputVector();
|
FVector InputVector = GetCharacterMovement()->GetLastInputVector();
|
||||||
if (InputVector.Equals(FVector(0, 0, 0), 0.001f))
|
if (InputVector.Equals(FVector(0, 0, 0), 0.001f))
|
||||||
|
@ -185,7 +187,7 @@ FRotator ACombatCharacter::GetDesiredRotation_Implementation()
|
||||||
return UKismetMathLibrary::MakeRotFromX(GetLastMovementInputVector());
|
return UKismetMathLibrary::MakeRotFromX(GetLastMovementInputVector());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanReceiveDamage_Implementation()
|
bool ACombatPlayerCharacter::CanReceiveDamage_Implementation()
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
result = (StateManagerComponent->GetCurrentState() != FCombatGameplayTags::Get().Character_State_Dead);
|
result = (StateManagerComponent->GetCurrentState() != FCombatGameplayTags::Get().Character_State_Dead);
|
||||||
|
@ -195,78 +197,70 @@ bool ACombatCharacter::CanReceiveDamage_Implementation()
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Input
|
// Input
|
||||||
|
|
||||||
void ACombatCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
|
void ACombatPlayerCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
|
||||||
{
|
{
|
||||||
// Set up action bindings
|
// Set up action bindings
|
||||||
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
|
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
|
||||||
{
|
{
|
||||||
//Jumping
|
//Jumping
|
||||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ACombatCharacter::Jumping);
|
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::Jumping);
|
||||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
|
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
|
||||||
|
|
||||||
//Moving
|
//Moving
|
||||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ACombatCharacter::Move);
|
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::Move);
|
||||||
|
|
||||||
//Looking
|
//Looking
|
||||||
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &ACombatCharacter::Look);
|
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::Look);
|
||||||
|
|
||||||
//Interact
|
//Interact
|
||||||
EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Started, this, &ACombatCharacter::Interact);
|
EnhancedInputComponent->BindAction(InteractAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::Interact);
|
||||||
|
|
||||||
//ToggleCombat
|
//ToggleCombat
|
||||||
EnhancedInputComponent->BindAction(ToggleCombatInputAction, ETriggerEvent::Started, this, &ACombatCharacter::ToggleCombatAction);
|
EnhancedInputComponent->BindAction(ToggleCombatInputAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::ToggleCombatAction);
|
||||||
|
|
||||||
//LightAttack
|
//LightAttack
|
||||||
EnhancedInputComponent->BindAction(LightAttackAction, ETriggerEvent::Triggered, this, &ACombatCharacter::LightChargeAttack);
|
EnhancedInputComponent->BindAction(LightAttackAction, ETriggerEvent::Triggered, this, &ACombatPlayerCharacter::LightChargeAttack);
|
||||||
EnhancedInputComponent->BindAction(LightAttackAction, ETriggerEvent::Completed, this, &ACombatCharacter::LightAttack);
|
EnhancedInputComponent->BindAction(LightAttackAction, ETriggerEvent::Completed, this, &ACombatPlayerCharacter::LightAttack);
|
||||||
|
|
||||||
//HeavyAttack
|
//HeavyAttack
|
||||||
EnhancedInputComponent->BindAction(HeavyAttackAction, ETriggerEvent::Started, this, &ACombatCharacter::HeavyAttack);
|
EnhancedInputComponent->BindAction(HeavyAttackAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::HeavyAttack);
|
||||||
|
|
||||||
//Dodge
|
//Dodge
|
||||||
EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &ACombatCharacter::Dodge);
|
EnhancedInputComponent->BindAction(DodgeAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::Dodge);
|
||||||
|
|
||||||
//ToggleWalk
|
//ToggleWalk
|
||||||
EnhancedInputComponent->BindAction(ToggleWalkAction, ETriggerEvent::Started, this, &ACombatCharacter::ToggleWalk);
|
EnhancedInputComponent->BindAction(ToggleWalkAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::ToggleWalk);
|
||||||
|
|
||||||
//Sprint
|
//Sprint
|
||||||
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &ACombatCharacter::StartSprint);
|
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::StartSprint);
|
||||||
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &ACombatCharacter::StopSprint);
|
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &ACombatPlayerCharacter::StopSprint);
|
||||||
|
|
||||||
//ToggleLockOn
|
//ToggleLockOn
|
||||||
EnhancedInputComponent->BindAction(ToggleLockOnAction, ETriggerEvent::Started, this, &ACombatCharacter::ToggleLockOn);
|
EnhancedInputComponent->BindAction(ToggleLockOnAction, ETriggerEvent::Started, this, &ACombatPlayerCharacter::ToggleLockOn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::SetCanMove_Implementation(bool inputCanMove)
|
void ACombatPlayerCharacter::SetCanMove_Implementation(bool inputCanMove)
|
||||||
{
|
{
|
||||||
bCanMove = inputCanMove;
|
bCanMove = inputCanMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ActivateCollision_Implementation(ECollisionPart CollisionPart)
|
void ACombatPlayerCharacter::ActivateCollision_Implementation(ECollisionPart CollisionPart)
|
||||||
{
|
{
|
||||||
ABaseWeapon* weapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* weapon = CombatComponent->GetMainWeapon();
|
||||||
if(IsValid(weapon))
|
if(IsValid(weapon))
|
||||||
weapon->ActivateCollision(CollisionPart);
|
weapon->ActivateCollision(CollisionPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::DeactivateCollision_Implementation(ECollisionPart CollisionPart)
|
void ACombatPlayerCharacter::DeactivateCollision_Implementation(ECollisionPart CollisionPart)
|
||||||
{
|
{
|
||||||
ABaseWeapon* weapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* weapon = CombatComponent->GetMainWeapon();
|
||||||
if(IsValid(weapon))
|
if(IsValid(weapon))
|
||||||
weapon->DeactivateCollision(CollisionPart);
|
weapon->DeactivateCollision(CollisionPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ToggleCombat_Implementation()
|
float ACombatPlayerCharacter::PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex)
|
||||||
{
|
{
|
||||||
ABaseWeapon* weapon = CombatComponent->GetMainWeapon();
|
|
||||||
if (IsValid(weapon))
|
|
||||||
weapon->ToggleWeaponCombat(!CombatComponent->GetCombatEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
float ACombatCharacter::PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex)
|
|
||||||
{
|
|
||||||
//TODO : 나중에 이 함수로 바꿔서 쓰기 혹시 몰라 구현만 해놓음
|
|
||||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
||||||
if (!CurrentWeapon)
|
if (!CurrentWeapon)
|
||||||
return false;
|
return false;
|
||||||
|
@ -299,9 +293,8 @@ float ACombatCharacter::PerformCombatAction(FGameplayTag ActionTag, FGameplayTag
|
||||||
return actionDuration;
|
return actionDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ACombatCharacter::PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
float ACombatPlayerCharacter::PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
||||||
{
|
{
|
||||||
//TODO : 나중에 이 함수로 바꿔서 쓰기 혹시 몰라 구현만 해놓음
|
|
||||||
if(!CombatComponent->GetCombatEnabled())
|
if(!CombatComponent->GetCombatEnabled())
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
||||||
|
@ -343,7 +336,7 @@ float ACombatCharacter::PerformCombatAttack(FGameplayTag AttackType, int32 Attac
|
||||||
return attackDuration;
|
return attackDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
void ACombatPlayerCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
||||||
{
|
{
|
||||||
if (NewSpeedMode == MovementSpeedMode)
|
if (NewSpeedMode == MovementSpeedMode)
|
||||||
return;
|
return;
|
||||||
|
@ -367,7 +360,7 @@ void ACombatCharacter::SetMovementSpeedMode(EMovementSpeedMode NewSpeedMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::Move(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::Move(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if(!bCanMove) //Value changes SetCanMove Func Call to Animnotify
|
if(!bCanMove) //Value changes SetCanMove Func Call to Animnotify
|
||||||
return;
|
return;
|
||||||
|
@ -393,7 +386,7 @@ void ACombatCharacter::Move(const FInputActionValue& Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::Look(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::Look(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
// input is a Vector2D
|
// input is a Vector2D
|
||||||
FVector2D LookAxisVector = Value.Get<FVector2D>();
|
FVector2D LookAxisVector = Value.Get<FVector2D>();
|
||||||
|
@ -411,7 +404,7 @@ void ACombatCharacter::Look(const FInputActionValue& Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::Jumping(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::Jumping(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (!CanJumping())
|
if (!CanJumping())
|
||||||
return;
|
return;
|
||||||
|
@ -422,7 +415,7 @@ void ACombatCharacter::Jumping(const FInputActionValue& Value)
|
||||||
Super::Jump();
|
Super::Jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::Interact(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::Interact(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
bool bInput = Value.Get<bool>();
|
bool bInput = Value.Get<bool>();
|
||||||
|
|
||||||
|
@ -440,14 +433,14 @@ void ACombatCharacter::Interact(const FInputActionValue& Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ToggleCombatAction(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::ToggleCombatAction(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
bool bInput = Value.Get<bool>();
|
bool bInput = Value.Get<bool>();
|
||||||
|
|
||||||
ToggleCombatEvent();
|
ToggleCombatEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::LightAttack(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::LightAttack(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (!ResetChargeAttack())
|
if (!ResetChargeAttack())
|
||||||
return;
|
return;
|
||||||
|
@ -460,7 +453,7 @@ void ACombatCharacter::LightAttack(const FInputActionValue& Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//누르고 있는 시간을 받기 위해서 FInputActionValue가 아니라 FInputActionInstance로 인자값을 받음
|
//누르고 있는 시간을 받기 위해서 FInputActionValue가 아니라 FInputActionInstance로 인자값을 받음
|
||||||
void ACombatCharacter::LightChargeAttack(const FInputActionInstance& Instance)
|
void ACombatPlayerCharacter::LightChargeAttack(const FInputActionInstance& Instance)
|
||||||
{
|
{
|
||||||
AttackHeldTime = Instance.GetElapsedTime();
|
AttackHeldTime = Instance.GetElapsedTime();
|
||||||
bAttackCharged = (AttackHeldTime >= ChargeAttackTime);
|
bAttackCharged = (AttackHeldTime >= ChargeAttackTime);
|
||||||
|
@ -468,7 +461,7 @@ void ACombatCharacter::LightChargeAttack(const FInputActionInstance& Instance)
|
||||||
ChargeAttackEvent();
|
ChargeAttackEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::HeavyAttack(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::HeavyAttack(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (bAttackCharged)
|
if (bAttackCharged)
|
||||||
return;
|
return;
|
||||||
|
@ -479,11 +472,11 @@ void ACombatCharacter::HeavyAttack(const FInputActionValue& Value)
|
||||||
AttackEvent();
|
AttackEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::Dodge(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::Dodge(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (CanPerformDodge())
|
if (CanPerformDodge())
|
||||||
{
|
{
|
||||||
PerformDodge();
|
PerformAction(FCombatGameplayTags::Get().Character_Action_Dodge, FCombatGameplayTags::Get().Character_State_Dodging, 0);
|
||||||
ABaseWeapon* pBaseWeapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* pBaseWeapon = CombatComponent->GetMainWeapon();
|
||||||
if (IsValid(pBaseWeapon))
|
if (IsValid(pBaseWeapon))
|
||||||
{
|
{
|
||||||
|
@ -493,7 +486,7 @@ void ACombatCharacter::Dodge(const FInputActionValue& Value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ToggleWalk(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::ToggleWalk(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (GetCombatMovementSpeedMode() != EMovementSpeedMode::Walking)
|
if (GetCombatMovementSpeedMode() != EMovementSpeedMode::Walking)
|
||||||
SetMovementSpeedMode(EMovementSpeedMode::Walking);
|
SetMovementSpeedMode(EMovementSpeedMode::Walking);
|
||||||
|
@ -502,30 +495,28 @@ void ACombatCharacter::ToggleWalk(const FInputActionValue& Value)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::StartSprint(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::StartSprint(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if (CanPerformSprint())
|
if (CanPerformSprint())
|
||||||
{
|
{
|
||||||
SetMovementSpeedMode(EMovementSpeedMode::Sprinting);
|
SetMovementSpeedMode(EMovementSpeedMode::Sprinting);
|
||||||
UWorld* World = GEngine->GetWorldFromContextObjectChecked(this);
|
UWorld* World = GEngine->GetWorldFromContextObjectChecked(this);
|
||||||
if (World)
|
if (World)
|
||||||
World->GetTimerManager().SetTimer(StaminaTimerHandle, this, &ACombatCharacter::SprintStaminaCost, 0.1f, true);
|
World->GetTimerManager().SetTimer(StaminaTimerHandle, this, &ACombatPlayerCharacter::SprintStaminaCost, 0.1f, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::StopSprint(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::StopSprint(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
DisableSprint();
|
DisableSprint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ToggleLockOn(const FInputActionValue& Value)
|
void ACombatPlayerCharacter::ToggleLockOn(const FInputActionValue& Value)
|
||||||
{
|
{
|
||||||
if(!CombatComponent->GetCombatEnabled() && !TargetingComponent->GetIsTargeting())
|
|
||||||
return;
|
|
||||||
TargetingComponent->ToggleLockOn();
|
TargetingComponent->ToggleLockOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::CharacterStateBegin(FGameplayTag CharState)
|
void ACombatPlayerCharacter::CharacterStateBegin(FGameplayTag CharState)
|
||||||
{
|
{
|
||||||
if (FGameplayTag::EmptyTag == CharState)
|
if (FGameplayTag::EmptyTag == CharState)
|
||||||
{/*None*/}
|
{/*None*/}
|
||||||
|
@ -543,7 +534,7 @@ void ACombatCharacter::CharacterStateBegin(FGameplayTag CharState)
|
||||||
{/*None*/}
|
{/*None*/}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::CharacterStateEnd(FGameplayTag CharState)
|
void ACombatPlayerCharacter::CharacterStateEnd(FGameplayTag CharState)
|
||||||
{
|
{
|
||||||
if (FGameplayTag::EmptyTag == CharState)
|
if (FGameplayTag::EmptyTag == CharState)
|
||||||
{/*None*/}
|
{/*None*/}
|
||||||
|
@ -559,55 +550,7 @@ void ACombatCharacter::CharacterStateEnd(FGameplayTag CharState)
|
||||||
{/*None*/}
|
{/*None*/}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::CharacterActionBegin(FGameplayTag CharAction)
|
void ACombatPlayerCharacter::CharacterCurrentStatValueUpdated(EStats statType, float value)
|
||||||
{
|
|
||||||
if(FGameplayTag::EmptyTag == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_GeneralAction == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Dodge == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_EnterCombat == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_ExitCombat == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_LightAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_HeavyAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_ChargedAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_FallingAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_SprintAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACombatCharacter::CharacterActionEnd(FGameplayTag CharAction)
|
|
||||||
{
|
|
||||||
if(FGameplayTag::EmptyTag == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_GeneralAction == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Dodge == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_EnterCombat == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_ExitCombat == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_LightAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_HeavyAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_ChargedAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_FallingAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
else if(FCombatGameplayTags::Get().Character_Action_Attack_SprintAttack == CharAction)
|
|
||||||
{/*None*/ }
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACombatCharacter::CharacterCurrentStatValueUpdated(EStats statType, float value)
|
|
||||||
{
|
{
|
||||||
if (!(statType == EStats::Health) || value > 0.f)
|
if (!(statType == EStats::Health) || value > 0.f)
|
||||||
return;
|
return;
|
||||||
|
@ -615,13 +558,13 @@ void ACombatCharacter::CharacterCurrentStatValueUpdated(EStats statType, float v
|
||||||
StateManagerComponent->SetCurrentState(FCombatGameplayTags::Get().Character_State_Dead);
|
StateManagerComponent->SetCurrentState(FCombatGameplayTags::Get().Character_State_Dead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::CharacterCombatToggled(bool IsCombatEnabled)
|
void ACombatPlayerCharacter::CharacterCombatToggled(bool IsCombatEnabled)
|
||||||
{
|
{
|
||||||
if(IsValid(TargetingComponent))
|
if(IsValid(TargetingComponent))
|
||||||
TargetingComponent->UpdateRotationMode();
|
TargetingComponent->UpdateRotationMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ToggleCombatEvent()
|
void ACombatPlayerCharacter::ToggleCombatEvent()
|
||||||
{
|
{
|
||||||
ABaseWeapon* baseWeapon = CombatComponent->GetMainWeapon();
|
ABaseWeapon* baseWeapon = CombatComponent->GetMainWeapon();
|
||||||
if (!baseWeapon)
|
if (!baseWeapon)
|
||||||
|
@ -631,12 +574,12 @@ void ACombatCharacter::ToggleCombatEvent()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!CombatComponent->GetCombatEnabled())
|
if (!CombatComponent->GetCombatEnabled())
|
||||||
PerformAction(FCombatGameplayTags::Get().Character_State_GeneralActionState, FCombatGameplayTags::Get().Character_Action_EnterCombat, 0);
|
PerformAction(FCombatGameplayTags::Get().Character_Action_EnterCombat, FCombatGameplayTags::Get().Character_State_GeneralActionState, 0);
|
||||||
else
|
else
|
||||||
PerformAction(FCombatGameplayTags::Get().Character_State_GeneralActionState, FCombatGameplayTags::Get().Character_Action_ExitCombat, 0);
|
PerformAction(FCombatGameplayTags::Get().Character_Action_ExitCombat, FCombatGameplayTags::Get().Character_State_GeneralActionState, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::AttackEvent()
|
void ACombatPlayerCharacter::AttackEvent()
|
||||||
{
|
{
|
||||||
if (!CanPerformAttack())
|
if (!CanPerformAttack())
|
||||||
return;
|
return;
|
||||||
|
@ -651,7 +594,7 @@ void ACombatCharacter::AttackEvent()
|
||||||
ToggleCombatEvent();
|
ToggleCombatEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ChargeAttackEvent()
|
void ACombatPlayerCharacter::ChargeAttackEvent()
|
||||||
{
|
{
|
||||||
if (CanPerformAttack())
|
if (CanPerformAttack())
|
||||||
{
|
{
|
||||||
|
@ -664,7 +607,7 @@ void ACombatCharacter::ChargeAttackEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::ResetChargeAttack()
|
bool ACombatPlayerCharacter::ResetChargeAttack()
|
||||||
{
|
{
|
||||||
AttackHeldTime = 0.f;
|
AttackHeldTime = 0.f;
|
||||||
if (bAttackCharged)
|
if (bAttackCharged)
|
||||||
|
@ -676,7 +619,7 @@ bool ACombatCharacter::ResetChargeAttack()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
void ACombatPlayerCharacter::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
||||||
{
|
{
|
||||||
if (!GetMesh())
|
if (!GetMesh())
|
||||||
return;
|
return;
|
||||||
|
@ -684,7 +627,7 @@ void ACombatCharacter::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
||||||
GetMesh()->SetPhysicsLinearVelocity(GetActorForwardVector() * -InitialSpeed, false, PelvisBoneName);
|
GetMesh()->SetPhysicsLinearVelocity(GetActorForwardVector() * -InitialSpeed, false, PelvisBoneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::EnableRagdoll()
|
void ACombatPlayerCharacter::EnableRagdoll()
|
||||||
{
|
{
|
||||||
GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None, 0); //movement 더 이상 없게 바꿈
|
GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None, 0); //movement 더 이상 없게 바꿈
|
||||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Ignore); //충돌무시
|
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Ignore); //충돌무시
|
||||||
|
@ -697,7 +640,7 @@ void ACombatCharacter::EnableRagdoll()
|
||||||
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(PelvisBoneName, 1.f);
|
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(PelvisBoneName, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::DisableSprint()
|
void ACombatPlayerCharacter::DisableSprint()
|
||||||
{
|
{
|
||||||
UWorld* World = GEngine->GetWorldFromContextObjectChecked(this);
|
UWorld* World = GEngine->GetWorldFromContextObjectChecked(this);
|
||||||
if (World)
|
if (World)
|
||||||
|
@ -707,7 +650,7 @@ void ACombatCharacter::DisableSprint()
|
||||||
SetMovementSpeedMode(EMovementSpeedMode::Jogging);
|
SetMovementSpeedMode(EMovementSpeedMode::Jogging);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::SprintStaminaCost()
|
void ACombatPlayerCharacter::SprintStaminaCost()
|
||||||
{
|
{
|
||||||
if (!CanPerformSprint())
|
if (!CanPerformSprint())
|
||||||
{
|
{
|
||||||
|
@ -723,7 +666,7 @@ void ACombatCharacter::SprintStaminaCost()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ApplyHitReaction(EDamageType InDamageType)
|
void ACombatPlayerCharacter::ApplyHitReaction(EDamageType InDamageType)
|
||||||
{
|
{
|
||||||
switch (InDamageType)
|
switch (InDamageType)
|
||||||
{
|
{
|
||||||
|
@ -741,7 +684,7 @@ void ACombatCharacter::ApplyHitReaction(EDamageType InDamageType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::ApplyImpactEffect(EDamageType InDamageType)
|
void ACombatPlayerCharacter::ApplyImpactEffect(EDamageType InDamageType)
|
||||||
{
|
{
|
||||||
//Play Sound
|
//Play Sound
|
||||||
UGameplayStatics::PlaySoundAtLocation(this, HitSound, LastHitInfo.Location);
|
UGameplayStatics::PlaySoundAtLocation(this, HitSound, LastHitInfo.Location);
|
||||||
|
@ -750,103 +693,7 @@ void ACombatCharacter::ApplyImpactEffect(EDamageType InDamageType)
|
||||||
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), HitEmitter, LastHitInfo.Location);
|
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), HitEmitter, LastHitInfo.Location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACombatCharacter::PerformAttack(FGameplayTag attackType, int32 attackIndex)
|
void ACombatPlayerCharacter::PerformDeath()
|
||||||
{
|
|
||||||
if(!CombatComponent->GetCombatEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
|
||||||
if (!CurrentWeapon)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TArray<UAnimMontage*> montages = CurrentWeapon->GetActionMontage(attackType);
|
|
||||||
int32 attackIdx = attackIndex;
|
|
||||||
|
|
||||||
if (montages.Num() <= attackIdx)
|
|
||||||
attackIdx = 0;
|
|
||||||
if (!montages.IsValidIndex(attackIdx))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UAnimMontage* attackMontage = montages[attackIdx];
|
|
||||||
if (!IsValid(attackMontage))
|
|
||||||
{
|
|
||||||
FString debugStr = FString::Printf(TEXT("Index %d Is NOT VALID!!"), attackIdx);
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Red, debugStr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StateManagerComponent->SetCurrentState(FCombatGameplayTags::Get().Character_State_Attacking);
|
|
||||||
StateManagerComponent->SetCurrentAction(attackType);
|
|
||||||
|
|
||||||
PlayAnimMontage(attackMontage);
|
|
||||||
|
|
||||||
int idx = attackIdx + 1;
|
|
||||||
if (idx >= montages.Num())
|
|
||||||
idx = 0;
|
|
||||||
|
|
||||||
CombatComponent->SetAttackCount(idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//인자값은 나중에 필요하면 추가 PerformDodge(int32 dodgeIndex)
|
|
||||||
void ACombatCharacter::PerformDodge()
|
|
||||||
{
|
|
||||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
|
||||||
if (!CurrentWeapon)
|
|
||||||
return;
|
|
||||||
int32 montageIndex = 0;
|
|
||||||
TArray<UAnimMontage*> montages = CurrentWeapon->GetActionMontage(FCombatGameplayTags::Get().Character_Action_Dodge);
|
|
||||||
if (montages.Num() <= montageIndex)
|
|
||||||
montageIndex = 0;
|
|
||||||
if (!montages.IsValidIndex(montageIndex))
|
|
||||||
return;
|
|
||||||
|
|
||||||
UAnimMontage* dodgeMontage = montages[montageIndex];
|
|
||||||
if (IsValid(dodgeMontage))
|
|
||||||
{
|
|
||||||
StateManagerComponent->SetCurrentState(FCombatGameplayTags::Get().Character_State_Dodging);
|
|
||||||
StateManagerComponent->SetCurrentAction(FCombatGameplayTags::Get().Character_Action_Dodge);
|
|
||||||
PlayAnimMontage(dodgeMontage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FString str = FString::Printf(TEXT("Dodge Index %n is NOT VALID!!"), montageIndex);
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Red, str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ACombatCharacter::PerformAction(FGameplayTag characterState, FGameplayTag characterAction, int32 montageIndex)
|
|
||||||
{
|
|
||||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
|
||||||
if (!CurrentWeapon)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
TArray<UAnimMontage*> montages = CurrentWeapon->GetActionMontage(characterAction);
|
|
||||||
int32 montageIdx = montageIndex;
|
|
||||||
|
|
||||||
if (montages.Num() <= montageIdx)
|
|
||||||
montageIdx = 0;
|
|
||||||
if (!montages.IsValidIndex(montageIdx))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
UAnimMontage* actionMontage = montages[montageIdx];
|
|
||||||
if (IsValid(actionMontage))
|
|
||||||
{
|
|
||||||
StateManagerComponent->SetCurrentState(characterState);
|
|
||||||
StateManagerComponent->SetCurrentAction(characterAction);
|
|
||||||
PlayAnimMontage(actionMontage);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FString str = FString::Printf(TEXT("Dodge Index %n is NOT VALID!!"), montageIdx);
|
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Red, str);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ACombatCharacter::PerformDeath()
|
|
||||||
{
|
{
|
||||||
EnableRagdoll();
|
EnableRagdoll();
|
||||||
ApplyHitReactionPhysicsVelocity(2000.f); //충돌을 좀 더 그럴싸하게 하기 위해서 뒷방향으로 충격
|
ApplyHitReactionPhysicsVelocity(2000.f); //충돌을 좀 더 그럴싸하게 하기 위해서 뒷방향으로 충격
|
||||||
|
@ -863,7 +710,7 @@ void ACombatCharacter::PerformDeath()
|
||||||
}), 4.f, false); // 4초 후에 object 삭제
|
}), 4.f, false); // 4초 후에 object 삭제
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::PerformHitStun()
|
bool ACombatPlayerCharacter::PerformHitStun()
|
||||||
{
|
{
|
||||||
UAnimMontage* hitMontage = nullptr;
|
UAnimMontage* hitMontage = nullptr;
|
||||||
if(bHitFront)
|
if(bHitFront)
|
||||||
|
@ -879,7 +726,7 @@ bool ACombatCharacter::PerformHitStun()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::PerformKnockdown()
|
bool ACombatPlayerCharacter::PerformKnockdown()
|
||||||
{
|
{
|
||||||
UAnimMontage* hitMontage = nullptr;
|
UAnimMontage* hitMontage = nullptr;
|
||||||
if(bHitFront)
|
if(bHitFront)
|
||||||
|
@ -895,7 +742,7 @@ bool ACombatCharacter::PerformKnockdown()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanPerformToggleCombat()
|
bool ACombatPlayerCharacter::CanPerformToggleCombat()
|
||||||
{
|
{
|
||||||
bool ReturnValue = true;
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
@ -911,7 +758,7 @@ bool ACombatCharacter::CanPerformToggleCombat()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanPerformAttack()
|
bool ACombatPlayerCharacter::CanPerformAttack()
|
||||||
{
|
{
|
||||||
bool ReturnValue = true;
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
@ -928,7 +775,7 @@ bool ACombatCharacter::CanPerformAttack()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanPerformDodge()
|
bool ACombatPlayerCharacter::CanPerformDodge()
|
||||||
{
|
{
|
||||||
bool ReturnValue = true;
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
@ -944,7 +791,7 @@ bool ACombatCharacter::CanPerformDodge()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanJumping()
|
bool ACombatPlayerCharacter::CanJumping()
|
||||||
{
|
{
|
||||||
bool ReturnValue = true;
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
@ -959,7 +806,7 @@ bool ACombatCharacter::CanJumping()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanReceiveHitReaction()
|
bool ACombatPlayerCharacter::CanReceiveHitReaction()
|
||||||
{
|
{
|
||||||
bool ReturnValue = true;
|
bool ReturnValue = true;
|
||||||
|
|
||||||
|
@ -970,12 +817,12 @@ bool ACombatCharacter::CanReceiveHitReaction()
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ACombatCharacter::CanPerformSprint()
|
bool ACombatPlayerCharacter::CanPerformSprint()
|
||||||
{
|
{
|
||||||
return (FMath::IsNearlyEqual(GetVelocity().Length(), 0.f)) == false;
|
return (FMath::IsNearlyEqual(GetVelocity().Length(), 0.f)) == false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FGameplayTag ACombatCharacter::GetDesiredAttackType()
|
FGameplayTag ACombatPlayerCharacter::GetDesiredAttackType()
|
||||||
{
|
{
|
||||||
if (GetCharacterMovement()->IsFalling())
|
if (GetCharacterMovement()->IsFalling())
|
||||||
return FCombatGameplayTags::Get().Character_Action_Attack_FallingAttack;
|
return FCombatGameplayTags::Get().Character_Action_Attack_FallingAttack;
|
|
@ -12,11 +12,11 @@
|
||||||
#include "Components/StatsComponent.h"
|
#include "Components/StatsComponent.h"
|
||||||
#include "Components/TargetingComponent.h"
|
#include "Components/TargetingComponent.h"
|
||||||
#include "Definitions/GameEnums.h"
|
#include "Definitions/GameEnums.h"
|
||||||
#include "CombatCharacter.generated.h"
|
#include "CombatPlayerCharacter.generated.h"
|
||||||
|
|
||||||
|
|
||||||
UCLASS(config=Game)
|
UCLASS(config=Game)
|
||||||
class ACombatCharacter : public ACharacter, public ICombatInterface, public IGameplayTagAssetInterface
|
class ACombatPlayerCharacter : public ACharacter, public ICombatInterface, public IGameplayTagAssetInterface
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class ACombatCharacter : public ACharacter, public ICombatInterface, public IGam
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
float ChargeAttackTime;
|
float ChargeAttackTime;
|
||||||
public:
|
public:
|
||||||
ACombatCharacter();
|
ACombatPlayerCharacter();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Returns CameraBoom subobject **/
|
/** Returns CameraBoom subobject **/
|
||||||
|
@ -113,13 +113,10 @@ public:
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
void DeactivateCollision(ECollisionPart CollisionPart);
|
void DeactivateCollision(ECollisionPart CollisionPart);
|
||||||
virtual void DeactivateCollision_Implementation(ECollisionPart CollisionPart) override;
|
virtual void DeactivateCollision_Implementation(ECollisionPart CollisionPart) override;
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
|
||||||
void ToggleCombat();
|
|
||||||
virtual void ToggleCombat_Implementation() override;
|
|
||||||
|
|
||||||
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
virtual EMovementSpeedMode GetCombatMovementSpeedMode() override { return GetMovementSpeedMode(); }
|
||||||
virtual float PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex);
|
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false);
|
||||||
virtual float PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex);
|
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||||
|
|
||||||
// Inherited via IGameplayTagAssetInterface
|
// Inherited via IGameplayTagAssetInterface
|
||||||
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = OwnedGameplayTags; }
|
virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = OwnedGameplayTags; }
|
||||||
|
@ -146,8 +143,6 @@ protected:
|
||||||
private://Delegate
|
private://Delegate
|
||||||
void CharacterStateBegin(FGameplayTag CharState);
|
void CharacterStateBegin(FGameplayTag CharState);
|
||||||
void CharacterStateEnd(FGameplayTag CharState);
|
void CharacterStateEnd(FGameplayTag CharState);
|
||||||
void CharacterActionBegin(FGameplayTag CharAction);
|
|
||||||
void CharacterActionEnd(FGameplayTag CharAction);
|
|
||||||
void CharacterCurrentStatValueUpdated(EStats statType, float value);
|
void CharacterCurrentStatValueUpdated(EStats statType, float value);
|
||||||
|
|
||||||
void CharacterCombatToggled(bool IsCombatEnabled);
|
void CharacterCombatToggled(bool IsCombatEnabled);
|
||||||
|
@ -164,9 +159,6 @@ private:
|
||||||
void ApplyImpactEffect(EDamageType InDamageType);
|
void ApplyImpactEffect(EDamageType InDamageType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PerformAttack(FGameplayTag attackType, int32 attackIndex);
|
|
||||||
void PerformDodge();
|
|
||||||
bool PerformAction(FGameplayTag characterState, FGameplayTag characterAction, int32 montageIndex);
|
|
||||||
void PerformDeath();
|
void PerformDeath();
|
||||||
bool PerformHitStun();
|
bool PerformHitStun();
|
||||||
bool PerformKnockdown();
|
bool PerformKnockdown();
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "Components/CollisionComponent.h"
|
#include "Components/CollisionComponent.h"
|
||||||
|
|
||||||
|
#include "GameplayTagAssetInterface.h"
|
||||||
|
|
||||||
|
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UCollisionComponent::UCollisionComponent()
|
UCollisionComponent::UCollisionComponent()
|
||||||
|
@ -61,3 +63,12 @@ void UCollisionComponent::ActivateCollision()
|
||||||
bCollisionEnabled = true;
|
bCollisionEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UCollisionComponent::CanHitActor(AActor* InActor)
|
||||||
|
{
|
||||||
|
IGameplayTagAssetInterface* tagInterface = Cast<IGameplayTagAssetInterface>(InActor);
|
||||||
|
if(tagInterface)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
FORCEINLINE void DeactivateCollision() { bCollisionEnabled = false; }
|
FORCEINLINE void DeactivateCollision() { bCollisionEnabled = false; }
|
||||||
bool IsCollisionEnabled() { return bCollisionEnabled; }
|
bool IsCollisionEnabled() { return bCollisionEnabled; }
|
||||||
|
bool CanHitActor(AActor* InActor);
|
||||||
private:
|
private:
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
||||||
float TraceRadius;
|
float TraceRadius;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||||
|
|
||||||
#include "D1GameMode.h"
|
#include "D1GameMode.h"
|
||||||
#include "CombatCharacter.h"
|
#include "CombatPlayerCharacter.h"
|
||||||
#include "UObject/ConstructorHelpers.h"
|
#include "UObject/ConstructorHelpers.h"
|
||||||
|
|
||||||
AD1GameMode::AD1GameMode()
|
AD1GameMode::AD1GameMode()
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include "Interface/CombatInterface.h"
|
#include "Interface/CombatInterface.h"
|
||||||
|
|
||||||
// Add default functionality here for any ICombatInterface functions that are not pure virtual.
|
// Add default functionality here for any ICombatInterface functions that are not pure virtual.
|
||||||
float ICombatInterface::PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex,
|
float ICombatInterface::PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex,
|
||||||
bool bRandomIndex)
|
bool bRandomIndex)
|
||||||
{
|
{
|
||||||
return 0.f;
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ICombatInterface::PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
float ICombatInterface::PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex)
|
||||||
{
|
{
|
||||||
return 0.f;
|
return 0.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,15 +40,13 @@ public:
|
||||||
void ActivateCollision(ECollisionPart CollisionPart);
|
void ActivateCollision(ECollisionPart CollisionPart);
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||||
void DeactivateCollision(ECollisionPart CollisionPart);
|
void DeactivateCollision(ECollisionPart CollisionPart);
|
||||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
|
||||||
void ToggleCombat();
|
|
||||||
|
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
virtual EMovementSpeedMode GetCombatMovementSpeedMode() = 0;
|
virtual EMovementSpeedMode GetCombatMovementSpeedMode() = 0;
|
||||||
UFUNCTION(Category="CombatActions")
|
UFUNCTION(Category="CombatActions")
|
||||||
virtual float PerformCombatAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex);
|
virtual float PerformAction(FGameplayTag ActionTag, FGameplayTag StateTag, int32 MontageIndex, bool bRandomIndex = false);
|
||||||
UFUNCTION(Category="CombatActions")
|
UFUNCTION(Category="CombatActions")
|
||||||
virtual float PerformCombatAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex);
|
virtual float PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool bRandomIndex = false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "UI/CombatHUD.h"
|
#include "UI/CombatHUD.h"
|
||||||
|
|
||||||
#include "UI_BossHealth.h"
|
|
||||||
#include "UI/UI_MainHUD.h"
|
#include "UI/UI_MainHUD.h"
|
||||||
|
|
||||||
void ACombatHUD::BeginPlay()
|
void ACombatHUD::BeginPlay()
|
||||||
|
@ -19,11 +18,5 @@ void ACombatHUD::BeginPlay()
|
||||||
UUI_MainHUD* outputUI = CreateWidget<UUI_MainHUD>(Contorller, MainUI);
|
UUI_MainHUD* outputUI = CreateWidget<UUI_MainHUD>(Contorller, MainUI);
|
||||||
outputUI->AddToViewport();
|
outputUI->AddToViewport();
|
||||||
}
|
}
|
||||||
|
|
||||||
UUI_BossHealth* BossHealthRef = CreateWidget<UUI_BossHealth>(Contorller, UUI_BossHealth::StaticClass());
|
|
||||||
if (BossHealthRef) //ExposeOnSpawn 대용으로 사용
|
|
||||||
{
|
|
||||||
BossHealthRef->AddToViewport();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ void UUI_HealthBar::NativeConstruct()
|
||||||
{
|
{
|
||||||
Super::NativeConstruct();
|
Super::NativeConstruct();
|
||||||
|
|
||||||
if(bUsePlayerStatsComponent)
|
if(!IsValid(StatsComponent))
|
||||||
{
|
{
|
||||||
if(const APlayerController* playerController = GetOwningPlayer())
|
if(const APlayerController* playerController = GetOwningPlayer())
|
||||||
StatsComponent = playerController->GetComponentByClass<UStatsComponent>();
|
StatsComponent = playerController->GetComponentByClass<UStatsComponent>();
|
||||||
|
|
|
@ -26,8 +26,6 @@ private:
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization" , meta=(AllowPrivateAccess="true"))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization" , meta=(AllowPrivateAccess="true"))
|
||||||
EStats StatType;
|
EStats StatType;
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization" , meta=(AllowPrivateAccess="true"))
|
|
||||||
bool bUsePlayerStatsComponent;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
|
|
|
@ -6,13 +6,7 @@
|
||||||
|
|
||||||
void UUI_StatBar::NativeConstruct()
|
void UUI_StatBar::NativeConstruct()
|
||||||
{
|
{
|
||||||
APawn* pplayer = GetOwningPlayerPawn();
|
InitializeStatBar(nullptr);
|
||||||
if (pplayer)
|
|
||||||
{
|
|
||||||
StatsComponent = pplayer->GetComponentByClass<UStatsComponent>();
|
|
||||||
if (IsValid(StatsComponent))
|
|
||||||
StatsComponent->OnCurrentStatValueUpdated.AddUObject(this, &UUI_StatBar::StatBarStatValueUpdated);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UUI_StatBar::StatBarStatValueUpdated(EStats stat, float value)
|
void UUI_StatBar::StatBarStatValueUpdated(EStats stat, float value)
|
||||||
|
@ -26,3 +20,17 @@ void UUI_StatBar::StatBarStatValueUpdated(EStats stat, float value)
|
||||||
float fPercent = value / StatsComponent->GetMaxStatValue(StatType);
|
float fPercent = value / StatsComponent->GetMaxStatValue(StatType);
|
||||||
StatBar->SetPercent(fPercent);
|
StatBar->SetPercent(fPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UUI_StatBar::InitializeStatBar(UStatsComponent* InputStatsComponent)
|
||||||
|
{
|
||||||
|
if(IsValid(InputStatsComponent))
|
||||||
|
StatsComponent = InputStatsComponent;
|
||||||
|
else if(!IsValid(StatsComponent))
|
||||||
|
{
|
||||||
|
APawn* pplayer = GetOwningPlayerPawn();
|
||||||
|
if (pplayer)
|
||||||
|
StatsComponent = pplayer->GetComponentByClass<UStatsComponent>();
|
||||||
|
}
|
||||||
|
StatsComponent->OnCurrentStatValueUpdated.AddUObject(this, &UUI_StatBar::StatBarStatValueUpdated);
|
||||||
|
StatBarStatValueUpdated(StatType, StatsComponent->GetCurrentStatValue(StatType));
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ protected:
|
||||||
virtual void NativeConstruct() override;
|
virtual void NativeConstruct() override;
|
||||||
public: //Delegate
|
public: //Delegate
|
||||||
void StatBarStatValueUpdated(EStats stat, float value);
|
void StatBarStatValueUpdated(EStats stat, float value);
|
||||||
|
public:
|
||||||
|
void InitializeStatBar(UStatsComponent* InputStatsComponent);
|
||||||
public:
|
public:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidget))
|
||||||
TObjectPtr<class UProgressBar> StatBar;
|
TObjectPtr<class UProgressBar> StatBar;
|
||||||
|
|
Loading…
Reference in New Issue