[박치영] Dual Swords 작업 중
parent
b5d514ec53
commit
ceaeb57aab
|
@ -75,4 +75,20 @@ Plugins/*/Intermediate/*
|
|||
DerivedDataCache/*
|
||||
|
||||
# Art Resource Folder
|
||||
/Content/D1Art
|
||||
/Content/D1Art
|
||||
|
||||
#Rider
|
||||
.idea/
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/contentModel.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/.idea.D1.iml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -126,3 +126,7 @@ ManualIPAddress=
|
|||
+CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
|
||||
+CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")
|
||||
|
||||
|
||||
[CoreRedirects]
|
||||
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.EnableCollision",NewName="/Script/D1.CollisionComponent.ActivateCollision")
|
||||
+FunctionRedirects=(OldName="/Script/D1.CollisionComponent.DisableCollision",NewName="/Script/D1.CollisionComponent.DeactivateCollision")
|
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.
|
@ -0,0 +1,75 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Actor/BaseDualWeapon.h"
|
||||
#include "Components/CollisionComponent.h"
|
||||
#include "Components/CombatComponent.h"
|
||||
#include "GameFramework/Character.h"
|
||||
|
||||
ABaseDualWeapon::ABaseDualWeapon()
|
||||
{
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::OnEquipped()
|
||||
{
|
||||
Super::OnEquipped();
|
||||
OffhandWeaponCollisionComponent->SetCollisionMeshComponent(OffhandWeaponMesh);
|
||||
|
||||
ACharacter* pCharacter = Cast<ACharacter>(GetOwner());
|
||||
if(pCharacter)
|
||||
RightFoot->SetCollisionMeshComponent(pCharacter->GetMesh());
|
||||
|
||||
if(CombatComponent->GetCombatEnabled())
|
||||
AttackOffhandWeapon(SecondWeaponHandSocket);
|
||||
else
|
||||
AttackOffhandWeapon(SecondWeaponAttackSocket);
|
||||
|
||||
OffhandWeaponCollisionComponent->AddActorToIgnore(GetOwner());
|
||||
RightFoot->AddActorToIgnore(GetOwner());
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::ActivateCollision(ECollisionPart CollisionPart)
|
||||
{
|
||||
switch (CollisionPart)
|
||||
{
|
||||
case ECollisionPart::MainWeapon:
|
||||
CollisionComponent->ActivateCollision();
|
||||
break;
|
||||
case ECollisionPart::OffhandWeapon:
|
||||
OffhandWeaponCollisionComponent->ActivateCollision();
|
||||
break;
|
||||
case ECollisionPart::RightFoot:
|
||||
RightFoot->ActivateCollision();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::DeactivateCollision(ECollisionPart CollsionPart)
|
||||
{
|
||||
switch (CollsionPart)
|
||||
{
|
||||
case ECollisionPart::MainWeapon:
|
||||
CollisionComponent->DeactivateCollision();
|
||||
break;
|
||||
case ECollisionPart::OffhandWeapon:
|
||||
OffhandWeaponCollisionComponent->DeactivateCollision();
|
||||
break;
|
||||
case ECollisionPart::RightFoot:
|
||||
RightFoot->DeactivateCollision();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ABaseDualWeapon::AttackOffhandWeapon(FName Socket)
|
||||
{
|
||||
ACharacter* pCharacter = Cast<ACharacter>(GetOwner());
|
||||
if(pCharacter)
|
||||
{
|
||||
FAttachmentTransformRules rules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, true);
|
||||
OffhandWeaponMesh->AttachToComponent(pCharacter->GetMesh(), rules, Socket);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Actor/BaseWeapon.h"
|
||||
#include "BaseDualWeapon.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class UCollisionComponent;
|
||||
|
||||
UCLASS()
|
||||
class D1_API ABaseDualWeapon : public ABaseWeapon
|
||||
{
|
||||
private:
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ABaseDualWeapon();
|
||||
|
||||
protected:
|
||||
virtual void OnEquipped() override;
|
||||
|
||||
virtual void ActivateCollision(ECollisionPart CollisionPart) override;
|
||||
virtual void DeactivateCollision(ECollisionPart CollsionPart) override;
|
||||
|
||||
public:
|
||||
void AttackOffhandWeapon(FName Socket);
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Mesh, meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<USkeletalMeshComponent> OffhandWeaponMesh;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components")
|
||||
TObjectPtr<UCollisionComponent> OffhandWeaponCollisionComponent;
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components")
|
||||
TObjectPtr<UCollisionComponent> RightFoot;
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
||||
FName SecondWeaponAttackSocket;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization")
|
||||
FName SecondWeaponHandSocket;
|
||||
};
|
|
@ -25,12 +25,12 @@ public:
|
|||
virtual bool GetIsEquipped();
|
||||
protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
|
||||
class USceneComponent* DefaultSceneRoot;
|
||||
TObjectPtr<class USceneComponent> DefaultSceneRoot;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Mesh, meta = (AllowPrivateAccess = "true"))
|
||||
class USkeletalMeshComponent* ItemSkeletalMesh;
|
||||
TObjectPtr<class USkeletalMeshComponent> ItemSkeletalMesh;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mesh, meta = (AllowPrivateAccess = "true"))
|
||||
class UStaticMeshComponent* ItemStaticMesh;
|
||||
TObjectPtr<class UStaticMeshComponent> ItemStaticMesh;
|
||||
protected:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
||||
bool bIsEquipped;
|
||||
|
|
|
@ -97,6 +97,16 @@ float ABaseWeapon::GetDamage()
|
|||
return outDamage;
|
||||
}
|
||||
|
||||
void ABaseWeapon::ActivateCollision(ECollisionPart CollisionPart)
|
||||
{
|
||||
CollisionComponent->ActivateCollision();
|
||||
}
|
||||
|
||||
void ABaseWeapon::DeactivateCollision(ECollisionPart CollsionPart)
|
||||
{
|
||||
CollisionComponent->DeactivateCollision();
|
||||
}
|
||||
|
||||
TArray<UAnimMontage*> ABaseWeapon::GetActionMontage(FGameplayTag characterAction)
|
||||
{
|
||||
TArray<UAnimMontage*> outputArr;
|
||||
|
|
|
@ -34,6 +34,12 @@ public:
|
|||
void SimulateWeaponPhysics();
|
||||
float GetStatCostForAction();
|
||||
float GetDamage();
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void ActivateCollision(ECollisionPart CollisionPart);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
virtual void DeactivateCollision(ECollisionPart CollsionPart);
|
||||
|
||||
public:
|
||||
TArray<UAnimMontage*> GetActionMontage(FGameplayTag characterAction);
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ ACombatCharacter::ACombatCharacter()
|
|||
// instead of recompiling to adjust them
|
||||
GetCharacterMovement()->MaxAcceleration = 1500.f;
|
||||
GetCharacterMovement()->BrakingFrictionFactor = 1.f;
|
||||
GetCharacterMovement()->bUseSeparateBrakingFriction = true; //Sprint 시 애니메이션이 끊기는 거 방지
|
||||
GetCharacterMovement()->bUseSeparateBrakingFriction = true; //Sprint 시 애니메이션이 끊기는 거 방지
|
||||
GetCharacterMovement()->JumpZVelocity = 700.f;
|
||||
GetCharacterMovement()->AirControl = 0.35f;
|
||||
GetCharacterMovement()->MaxWalkSpeed = 500.f;
|
||||
|
@ -102,7 +102,7 @@ void ACombatCharacter::BeginPlay()
|
|||
}
|
||||
}
|
||||
|
||||
//Player에 무기를 처음부터 들고있게함. 아마도 임시코드
|
||||
//Player에 무기를 처음부터 들고있게함. 아마도 임시코드
|
||||
FActorSpawnParameters spawnParam;
|
||||
spawnParam.Owner = this;
|
||||
spawnParam.Instigator = this;
|
||||
|
@ -224,8 +224,16 @@ void ACombatCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerIn
|
|||
}
|
||||
}
|
||||
|
||||
void ACombatCharacter::SetCanMove_Implementation(bool inputCanMove)
|
||||
{
|
||||
bCanMove = inputCanMove;
|
||||
}
|
||||
|
||||
void ACombatCharacter::Move(const FInputActionValue& Value)
|
||||
{
|
||||
if(!bCanMove) //Value changes SetCanMove Func Call to Animnotify
|
||||
return;
|
||||
|
||||
// input is a Vector2D
|
||||
FVector2D MovementVector = Value.Get<FVector2D>();
|
||||
|
||||
|
@ -308,7 +316,7 @@ void ACombatCharacter::LightAttack(const FInputActionValue& Value)
|
|||
AttackEvent();
|
||||
}
|
||||
|
||||
//누르고 있는 시간을 받기 위해서 FInputActionValue가 아니라 FInputActionInstance로 인자값을 받음
|
||||
//누르고 있는 시간을 받기 위해서 FInputActionValue가 아니라 FInputActionInstance로 인자값을 받음
|
||||
void ACombatCharacter::LightChargeAttack(const FInputActionInstance& Instance)
|
||||
{
|
||||
AttackHeldTime = Instance.GetElapsedTime();
|
||||
|
@ -508,13 +516,13 @@ void ACombatCharacter::ApplyHitReactionPhysicsVelocity(float InitialSpeed)
|
|||
|
||||
void ACombatCharacter::EnableRagdoll()
|
||||
{
|
||||
GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None, 0); //movement 더 이상 없게 바꿈
|
||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Ignore); //충돌무시
|
||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore); //카메라 충돌무시
|
||||
GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None, 0); //movement 더 이상 없게 바꿈
|
||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Ignore); //충돌무시
|
||||
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore); //카메라 충돌무시
|
||||
FAttachmentTransformRules rules(EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, EAttachmentRule::KeepWorld, true);
|
||||
GetCameraBoom()->AttachToComponent(GetMesh(), rules, PelvisBoneName); //camera를 척추뼈에 붙임
|
||||
GetCameraBoom()->bDoCollisionTest = false; //카메라 충돌 없게 함
|
||||
GetMesh()->SetCollisionProfileName(TEXT("ragdoll"), true); //ragdoll 로 변경
|
||||
GetCameraBoom()->AttachToComponent(GetMesh(), rules, PelvisBoneName); //camera를 척추뼈에 붙임
|
||||
GetCameraBoom()->bDoCollisionTest = false; //카메라 충돌 없게 함
|
||||
GetMesh()->SetCollisionProfileName(TEXT("ragdoll"), true); //ragdoll 로 변경
|
||||
GetMesh()->SetAllBodiesBelowSimulatePhysics(PelvisBoneName, true, true);
|
||||
GetMesh()->SetAllBodiesBelowPhysicsBlendWeight(PelvisBoneName, 1.f);
|
||||
}
|
||||
|
@ -615,7 +623,7 @@ void ACombatCharacter::PerformAttack(FGameplayTag attackType, int32 attackIndex)
|
|||
}
|
||||
}
|
||||
|
||||
//인자값은 나중에 필요하면 추가 PerformDodge(int32 dodgeIndex)
|
||||
//인자값은 나중에 필요하면 추가 PerformDodge(int32 dodgeIndex)
|
||||
void ACombatCharacter::PerformDodge()
|
||||
{
|
||||
ABaseWeapon* CurrentWeapon = CombatComponent->GetMainWeapon();
|
||||
|
@ -675,10 +683,10 @@ bool ACombatCharacter::PerformAction(FGameplayTag characterState, FGameplayTag c
|
|||
void ACombatCharacter::PerformDeath()
|
||||
{
|
||||
EnableRagdoll();
|
||||
ApplyHitReactionPhysicsVelocity(2000.f); //충돌을 좀 더 그럴싸하게 하기 위해서 뒷방향으로 충격
|
||||
ApplyHitReactionPhysicsVelocity(2000.f); //충돌을 좀 더 그럴싸하게 하기 위해서 뒷방향으로 충격
|
||||
|
||||
if (IsValid(CombatComponent->GetMainWeapon()))
|
||||
CombatComponent->GetMainWeapon()->SimulateWeaponPhysics(); //무기의 충돌킴
|
||||
CombatComponent->GetMainWeapon()->SimulateWeaponPhysics(); //무기의 충돌킴
|
||||
|
||||
FTimerHandle deathTimer;
|
||||
GetWorld()->GetTimerManager().SetTimer(deathTimer, FTimerDelegate::CreateLambda([&]()
|
||||
|
@ -686,7 +694,7 @@ void ACombatCharacter::PerformDeath()
|
|||
if (IsValid(CombatComponent->GetMainWeapon()))
|
||||
CombatComponent->GetMainWeapon()->Destroy();
|
||||
this->Destroy();
|
||||
}), 4.f, false); // 4초 후에 object 삭제
|
||||
}), 4.f, false); // 4초 후에 object 삭제
|
||||
}
|
||||
|
||||
bool ACombatCharacter::CanPerformToggleCombat()
|
||||
|
@ -784,4 +792,3 @@ FGameplayTag ACombatCharacter::GetDesiredAttackType()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ public:
|
|||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||
bool CanReceiveDamage();
|
||||
virtual bool CanReceiveDamage_Implementation() override;
|
||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||
void SetCanMove(bool inputCanMove);
|
||||
virtual void SetCanMove_Implementation(bool inputCanMove) override;
|
||||
|
||||
protected:
|
||||
//Input Funcs
|
||||
|
@ -147,6 +150,7 @@ protected:
|
|||
bool CanReceiveHitReaction();
|
||||
bool CanPerformSprint();
|
||||
FGameplayTag GetDesiredAttackType();
|
||||
|
||||
public:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components", meta=(AllowPrivateAccess="true"))
|
||||
TObjectPtr<class UCombatComponent> CombatComponent;
|
||||
|
@ -194,5 +198,6 @@ private:
|
|||
bool IsHeavyAttack;
|
||||
float AttackHeldTime;
|
||||
bool bAttackCharged;
|
||||
bool bCanMove = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ void UCollisionComponent::CollisionTrace()
|
|||
{
|
||||
HitActor = LastHit.GetActor();
|
||||
AlreadyHitActors.Add(HitActor);
|
||||
OnHitDelegate.ExecuteIfBound(LastHit); //Multi면 변경해야됨
|
||||
OnHitDelegate.ExecuteIfBound(LastHit); //Multi면 변경해야됨
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UCollisionComponent::EnableCollision()
|
||||
void UCollisionComponent::ActivateCollision()
|
||||
{
|
||||
ClearHitActors();
|
||||
bCollisionEnabled = true;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Kismet/KismetSystemLibrary.h"
|
||||
#include "CollisionComponent.generated.h"
|
||||
|
||||
//DECLARE_MULTICAST_DELEGATE_OneParam 로 변경 필요
|
||||
//DECLARE_MULTICAST_DELEGATE_OneParam -> It can be changed
|
||||
DECLARE_DELEGATE_OneParam(FOnHit, FHitResult);
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
|
@ -50,9 +50,9 @@ public:
|
|||
FORCEINLINE void SetDrawDebugType(TEnumAsByte<EDrawDebugTrace::Type> InputDrawDebugType) { DrawDebugType = InputDrawDebugType; }
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FORCEINLINE void EnableCollision();
|
||||
FORCEINLINE void ActivateCollision();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
FORCEINLINE void DisableCollision() { bCollisionEnabled = false; }
|
||||
FORCEINLINE void DeactivateCollision() { bCollisionEnabled = false; }
|
||||
bool IsCollisionEnabled() { return bCollisionEnabled; }
|
||||
private:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ECombatType : uint8
|
||||
{
|
||||
|
@ -21,3 +20,11 @@ enum class EMovementSpeedMode : uint8
|
|||
Sprinting UMETA(DisplayName = "Sprinting"),
|
||||
};
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ECollisionPart : uint8
|
||||
{
|
||||
MainWeapon UMETA(DisplayName = "MainWeapon"),
|
||||
OffhandWeapon UMETA(DisplayName = "OffhandWeapon"),
|
||||
RightFoot UMETA(DisplayName = "RightFoot"),
|
||||
};
|
||||
|
||||
|
|
|
@ -32,4 +32,6 @@ public:
|
|||
FRotator GetDesiredRotation();
|
||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||
bool CanReceiveDamage();
|
||||
UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
|
||||
void SetCanMove(bool inputCanMove);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue