Compare commits
2 Commits
a5d8639685
...
6993f354b4
Author | SHA1 | Date |
---|---|---|
|
6993f354b4 | |
|
4b0685aa91 |
|
@ -129,4 +129,5 @@ ManualIPAddress=
|
|||
|
||||
[CoreRedirects]
|
||||
+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")
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -5,9 +5,39 @@
|
|||
#include "Components/CollisionComponent.h"
|
||||
#include "Components/CombatComponent.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Interface/CombatInterface.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
ABaseDualWeapon::ABaseDualWeapon()
|
||||
{
|
||||
//Mesh
|
||||
OffhandWeaponMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OffhandWeaponMesh"));
|
||||
OffhandWeaponMesh->SetupAttachment(RootComponent);
|
||||
OffhandWeaponMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
|
||||
//Setting OffhandWeaponCollisionComponent
|
||||
OffhandWeaponCollisionComponent = CreateDefaultSubobject<UCollisionComponent>(TEXT("OffhandWeaponCollisionComponent"));
|
||||
OffhandWeaponCollisionComponent->OnHitDelegate.BindUObject(this, &ABaseDualWeapon::OnHit_OffhandWeapon);
|
||||
OffhandWeaponCollisionComponent->SetTraceRaius(20.f);
|
||||
OffhandWeaponCollisionComponent->SetStartSocketName(TEXT("WeaponStart"));
|
||||
OffhandWeaponCollisionComponent->SetEndSocketName(TEXT("WeaponEnd"));
|
||||
TArray<TEnumAsByte<EObjectTypeQuery>> OffhandWeaponCollisionObjectTypes;
|
||||
OffhandWeaponCollisionObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
|
||||
OffhandWeaponCollisionComponent->SetCollisionObjectTypes(OffhandWeaponCollisionObjectTypes);
|
||||
OffhandWeaponCollisionComponent->SetDrawDebugType(EDrawDebugTrace::None);
|
||||
|
||||
//Setting RightFootCollisionObjectTypes
|
||||
RightFootCollisionComponent = CreateDefaultSubobject<UCollisionComponent>(TEXT("RightFootCollisionComponent"));
|
||||
RightFootCollisionComponent->OnHitDelegate.BindUObject(this, &ABaseDualWeapon::OnHit_RightFoot);
|
||||
RightFootCollisionComponent->SetTraceRaius(20.f);
|
||||
RightFootCollisionComponent->SetStartSocketName(TEXT("foot_r_Socket"));
|
||||
RightFootCollisionComponent->SetEndSocketName(TEXT("calf_r_Socket"));
|
||||
TArray<TEnumAsByte<EObjectTypeQuery>> RightFootCollisionObjectTypes;
|
||||
RightFootCollisionObjectTypes.Add(UEngineTypes::ConvertToObjectType(ECollisionChannel::ECC_Pawn));
|
||||
RightFootCollisionComponent->SetCollisionObjectTypes(RightFootCollisionObjectTypes);
|
||||
RightFootCollisionComponent->SetDrawDebugType(EDrawDebugTrace::None);
|
||||
|
||||
CombatType = ECombatType::DUALSWORDS;
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::OnEquipped()
|
||||
|
@ -17,15 +47,15 @@ void ABaseDualWeapon::OnEquipped()
|
|||
|
||||
ACharacter* pCharacter = Cast<ACharacter>(GetOwner());
|
||||
if(pCharacter)
|
||||
RightFoot->SetCollisionMeshComponent(pCharacter->GetMesh());
|
||||
RightFootCollisionComponent->SetCollisionMeshComponent(pCharacter->GetMesh());
|
||||
|
||||
if(CombatComponent->GetCombatEnabled())
|
||||
AttackOffhandWeapon(SecondWeaponHandSocket);
|
||||
AttachOffhandWeapon(SecondWeaponHandSocket);
|
||||
else
|
||||
AttackOffhandWeapon(SecondWeaponAttackSocket);
|
||||
AttachOffhandWeapon(SecondWeaponAttackSocket);
|
||||
|
||||
OffhandWeaponCollisionComponent->AddActorToIgnore(GetOwner());
|
||||
RightFoot->AddActorToIgnore(GetOwner());
|
||||
RightFootCollisionComponent->AddActorToIgnore(GetOwner());
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::ActivateCollision(ECollisionPart CollisionPart)
|
||||
|
@ -39,7 +69,7 @@ void ABaseDualWeapon::ActivateCollision(ECollisionPart CollisionPart)
|
|||
OffhandWeaponCollisionComponent->ActivateCollision();
|
||||
break;
|
||||
case ECollisionPart::RightFoot:
|
||||
RightFoot->ActivateCollision();
|
||||
RightFootCollisionComponent->ActivateCollision();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -57,14 +87,44 @@ void ABaseDualWeapon::DeactivateCollision(ECollisionPart CollsionPart)
|
|||
OffhandWeaponCollisionComponent->DeactivateCollision();
|
||||
break;
|
||||
case ECollisionPart::RightFoot:
|
||||
RightFoot->DeactivateCollision();
|
||||
RightFootCollisionComponent->DeactivateCollision();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::AttackOffhandWeapon(FName Socket)
|
||||
void ABaseDualWeapon::ToggleCombat(bool EnableCombat)
|
||||
{
|
||||
Super::ToggleCombat(EnableCombat);
|
||||
|
||||
if(EnableCombat)
|
||||
AttachOffhandWeapon(SecondWeaponHandSocket);
|
||||
else
|
||||
AttachOffhandWeapon(SecondWeaponAttackSocket);
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::OnHit_OffhandWeapon(FHitResult HitResult)
|
||||
{
|
||||
ICombatInterface* pActor = Cast<ICombatInterface>(HitResult.GetActor());
|
||||
if(pActor)
|
||||
{
|
||||
if(pActor->Execute_CanReceiveDamage(HitResult.GetActor()))
|
||||
UGameplayStatics::ApplyPointDamage(HitResult.GetActor(), GetDamage(), GetOwner()->GetActorForwardVector(), HitResult, GetInstigatorController(), this, TSubclassOf<UDamageType>(UDamageType::StaticClass()));
|
||||
}
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::OnHit_RightFoot(FHitResult HitResult)
|
||||
{
|
||||
ICombatInterface* pActor = Cast<ICombatInterface>(HitResult.GetActor());
|
||||
if(pActor)
|
||||
{
|
||||
if(pActor->Execute_CanReceiveDamage(HitResult.GetActor()))
|
||||
UGameplayStatics::ApplyPointDamage(HitResult.GetActor(), GetDamage(), GetOwner()->GetActorForwardVector(), HitResult, GetInstigatorController(), this, TSubclassOf<UDamageType>(UDamageType::StaticClass()));
|
||||
}
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::AttachOffhandWeapon(FName Socket)
|
||||
{
|
||||
ACharacter* pCharacter = Cast<ACharacter>(GetOwner());
|
||||
if(pCharacter)
|
||||
|
|
|
@ -22,20 +22,25 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void OnEquipped() override;
|
||||
|
||||
virtual void ActivateCollision(ECollisionPart CollisionPart) override;
|
||||
virtual void DeactivateCollision(ECollisionPart CollsionPart) override;
|
||||
|
||||
virtual void ToggleCombat(bool EnableCombat) override;
|
||||
|
||||
public: //Delegate
|
||||
void OnHit_OffhandWeapon(FHitResult HitResult);
|
||||
void OnHit_RightFoot(FHitResult HitResult);
|
||||
|
||||
public:
|
||||
void AttackOffhandWeapon(FName Socket);
|
||||
void AttachOffhandWeapon(FName Socket);
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Mesh, meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<USkeletalMeshComponent> OffhandWeaponMesh;
|
||||
TObjectPtr<UStaticMeshComponent> OffhandWeaponMesh;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components")
|
||||
TObjectPtr<UCollisionComponent> OffhandWeaponCollisionComponent;
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components")
|
||||
TObjectPtr<UCollisionComponent> RightFoot;
|
||||
TObjectPtr<UCollisionComponent> RightFootCollisionComponent;
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
||||
FName SecondWeaponAttackSocket;
|
||||
|
|
|
@ -22,6 +22,11 @@ ABaseWeapon::ABaseWeapon()
|
|||
CollisionComponent->SetCollisionObjectTypes(InputCollisionObjectTypes);
|
||||
CollisionComponent->SetDrawDebugType(EDrawDebugTrace::None);
|
||||
|
||||
//Stats
|
||||
Damage = 20.f;
|
||||
if(!FCombatGameplayTags::Get().Character_Action_Attack_LightAttack.IsValid())
|
||||
FCombatGameplayTags::InitializeNativeGameplayTags();
|
||||
|
||||
ActionStatCost.Add(FCombatGameplayTags::Get().Character_Action_Attack_LightAttack, 10.f);
|
||||
ActionStatCost.Add(FCombatGameplayTags::Get().Character_Action_Attack_HeavyAttack, 15.f);
|
||||
ActionStatCost.Add(FCombatGameplayTags::Get().Character_Action_Attack_ChargedAttack, 20.f);
|
||||
|
@ -44,7 +49,7 @@ void ABaseWeapon::OnEquipped()
|
|||
return;
|
||||
CombatComponent = owner->GetComponentByClass<UCombatComponent>();
|
||||
OwnerStateManager = owner->GetComponentByClass<UStateManagerComponent>();
|
||||
|
||||
|
||||
if (CombatComponent->GetCombatEnabled())
|
||||
AttachActor(HandSocketName);
|
||||
else
|
||||
|
@ -107,6 +112,18 @@ void ABaseWeapon::DeactivateCollision(ECollisionPart CollsionPart)
|
|||
CollisionComponent->DeactivateCollision();
|
||||
}
|
||||
|
||||
void ABaseWeapon::ToggleCombat(bool EnableCombat)
|
||||
{
|
||||
if(!CombatComponent)
|
||||
return;
|
||||
|
||||
CombatComponent->SetCombatEnabled(EnableCombat);
|
||||
if(EnableCombat)
|
||||
AttachActor(HandSocketName);
|
||||
else
|
||||
AttachActor(AttachSocketName);
|
||||
}
|
||||
|
||||
TArray<UAnimMontage*> ABaseWeapon::GetActionMontage(FGameplayTag characterAction)
|
||||
{
|
||||
TArray<UAnimMontage*> outputArr;
|
||||
|
|
|
@ -34,11 +34,14 @@ public:
|
|||
void SimulateWeaponPhysics();
|
||||
float GetStatCostForAction();
|
||||
float GetDamage();
|
||||
|
||||
|
||||
//Call by Blueprint
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void ActivateCollision(ECollisionPart CollisionPart);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void DeactivateCollision(ECollisionPart CollsionPart);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void ToggleCombat(bool EnableCombat);
|
||||
|
||||
public:
|
||||
TArray<UAnimMontage*> GetActionMontage(FGameplayTag characterAction);
|
||||
|
@ -73,11 +76,10 @@ protected:
|
|||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Montages")
|
||||
TArray<TObjectPtr<UAnimMontage>> SprintAttackMontage;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Status")
|
||||
float Damage;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Status")
|
||||
TMap<FGameplayTag, float> ActionStatCost;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stat")
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Status")
|
||||
TMap<FGameplayTag, float> ActionDamageMultiplier;
|
||||
};
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "Components/StatsComponent.h"
|
||||
#include "Definitions/CombatGameplayTags.h"
|
||||
#include "Engine/DamageEvents.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "NiagaraComponent.h"
|
||||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
@ -127,7 +129,8 @@ float ACombatCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent
|
|||
UGameplayStatics::PlaySoundAtLocation(this, HitSound, PointDamageEvent->HitInfo.Location);
|
||||
|
||||
//Hit Effect
|
||||
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), HitEmitter, PointDamageEvent->HitInfo.Location);
|
||||
//UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), HitEmitter, PointDamageEvent->HitInfo.Location);
|
||||
UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), HitEmitter, PointDamageEvent->HitInfo.Location);
|
||||
|
||||
if (CanReceiveHitReaction())
|
||||
{
|
||||
|
|
|
@ -174,7 +174,7 @@ public:
|
|||
TObjectPtr<class USoundBase> HitSound;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<class UParticleSystem> HitEmitter;
|
||||
TObjectPtr<class UNiagaraSystem> HitEmitter;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MovementSpeed", meta = (AllowPrivateAccess = "true"))
|
||||
EMovementSpeedMode MovementSpeedMode;
|
||||
|
|
|
@ -10,7 +10,7 @@ public class D1 : ModuleRules
|
|||
|
||||
PublicDependencyModuleNames.AddRange(new string[] {
|
||||
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay",
|
||||
"EnhancedInput", "GameplayTags"
|
||||
"EnhancedInput", "GameplayTags", "Niagara"
|
||||
});
|
||||
|
||||
PublicIncludePaths.AddRange(new string[] { "D1" });
|
||||
|
|
|
@ -16,7 +16,7 @@ void UCombatAssetManager::StartInitialLoading()
|
|||
{
|
||||
Super::StartInitialLoading();
|
||||
|
||||
//AssetManager에서 Singleton 초기화
|
||||
//Editor의 Engine General Settings에서 설정 변경 필요
|
||||
//AssetManager에서 Singleton 초기화
|
||||
//Editor의 Engine General Settings에서 설정 변경 필요
|
||||
FCombatGameplayTags::InitializeNativeGameplayTags();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@ FCombatGameplayTags FCombatGameplayTags::GameplayTags;
|
|||
|
||||
void FCombatGameplayTags::InitializeNativeGameplayTags()
|
||||
{
|
||||
if(GameplayTags.Character_State_Attacking.IsValid()) //Already Execute? then Do not Execute
|
||||
return;
|
||||
|
||||
/**
|
||||
* State
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
FGameplayTag Character_Action_Attack_HeavyAttack;
|
||||
FGameplayTag Character_Action_Attack_LightAttack;
|
||||
FGameplayTag Character_Action_Attack_SprintAttack;
|
||||
|
||||
private:
|
||||
static FCombatGameplayTags GameplayTags;
|
||||
};
|
|
@ -9,7 +9,8 @@ enum class ECombatType : uint8
|
|||
{
|
||||
NONE UMETA(DisplayName = "NONE"),
|
||||
LIGHTSWORD UMETA(DisplayName = "LIGHTSWORD"),
|
||||
GREATSWORD UMETA(DisplayName = "GREATSWORD")
|
||||
GREATSWORD UMETA(DisplayName = "GREATSWORD"),
|
||||
DUALSWORDS UMETA(DisplayName = "DUALSWORDS")
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
|
|
Loading…
Reference in New Issue