diff --git a/.gitignore b/.gitignore index e7f62466..8ec3e970 100644 --- a/.gitignore +++ b/.gitignore @@ -75,4 +75,20 @@ Plugins/*/Intermediate/* DerivedDataCache/* # Art Resource Folder -/Content/D1Art \ No newline at end of file +/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 \ No newline at end of file diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 81291ada..06f0fd1e 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -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") \ No newline at end of file diff --git a/Content/CombatSystem/Blueprints/Animnotifies/CollisionTrace_ANS.uasset b/Content/CombatSystem/Blueprints/Animnotifies/CollisionTrace_ANS.uasset index 4589e463..f64a75dc 100644 Binary files a/Content/CombatSystem/Blueprints/Animnotifies/CollisionTrace_ANS.uasset and b/Content/CombatSystem/Blueprints/Animnotifies/CollisionTrace_ANS.uasset differ diff --git a/Content/CombatSystem/Blueprints/Animnotifies/DisableMovement_ANS.uasset b/Content/CombatSystem/Blueprints/Animnotifies/DisableMovement_ANS.uasset new file mode 100644 index 00000000..ef6e098f Binary files /dev/null and b/Content/CombatSystem/Blueprints/Animnotifies/DisableMovement_ANS.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_Air_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_Air_Montage.uasset new file mode 100644 index 00000000..5c372c84 Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_Air_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_C_Dash_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_C_Dash_Montage.uasset new file mode 100644 index 00000000..8a2efabb Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/Attack_Melee_C_Dash_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack1_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack1_Montage.uasset new file mode 100644 index 00000000..328bb8a1 Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack1_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack2_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack2_Montage.uasset new file mode 100644 index 00000000..b86346ac Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack2_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack3_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack3_Montage.uasset new file mode 100644 index 00000000..ace7080e Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_Attack3_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_ChargeAttack_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_ChargeAttack_Montage.uasset new file mode 100644 index 00000000..84eb7e3b Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_ChargeAttack_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_StrongAttack1_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_StrongAttack1_Montage.uasset new file mode 100644 index 00000000..debef909 Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Attack/DualSword_StrongAttack1_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/DrawDualSwords_Anim_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/DrawDualSwords_Anim_Montage.uasset new file mode 100644 index 00000000..7bcd6328 Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/DrawDualSwords_Anim_Montage.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/Locomotion/LightSword_BS.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/Locomotion/LightSword_BS.uasset new file mode 100644 index 00000000..8ea6699e Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/Locomotion/LightSword_BS.uasset differ diff --git a/Content/CombatSystem/CourseFiles/Animations/DualSword/ShealthDualSwords_Anim_Montage.uasset b/Content/CombatSystem/CourseFiles/Animations/DualSword/ShealthDualSwords_Anim_Montage.uasset new file mode 100644 index 00000000..372378ba Binary files /dev/null and b/Content/CombatSystem/CourseFiles/Animations/DualSword/ShealthDualSwords_Anim_Montage.uasset differ diff --git a/Source/D1/Actor/BaseDualWeapon.cpp b/Source/D1/Actor/BaseDualWeapon.cpp new file mode 100644 index 00000000..7d8b3c4c --- /dev/null +++ b/Source/D1/Actor/BaseDualWeapon.cpp @@ -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(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(GetOwner()); + if(pCharacter) + { + FAttachmentTransformRules rules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, true); + OffhandWeaponMesh->AttachToComponent(pCharacter->GetMesh(), rules, Socket); + } +} diff --git a/Source/D1/Actor/BaseDualWeapon.h b/Source/D1/Actor/BaseDualWeapon.h new file mode 100644 index 00000000..7a3766d4 --- /dev/null +++ b/Source/D1/Actor/BaseDualWeapon.h @@ -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 OffhandWeaponMesh; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components") + TObjectPtr OffhandWeaponCollisionComponent; + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="Components") + TObjectPtr RightFoot; +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization") + FName SecondWeaponAttackSocket; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization") + FName SecondWeaponHandSocket; +}; diff --git a/Source/D1/Actor/BaseEquippable.h b/Source/D1/Actor/BaseEquippable.h index 9c4e18da..fad5949f 100644 --- a/Source/D1/Actor/BaseEquippable.h +++ b/Source/D1/Actor/BaseEquippable.h @@ -25,12 +25,12 @@ public: virtual bool GetIsEquipped(); protected: UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true")) - class USceneComponent* DefaultSceneRoot; + TObjectPtr DefaultSceneRoot; UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Mesh, meta = (AllowPrivateAccess = "true")) - class USkeletalMeshComponent* ItemSkeletalMesh; + TObjectPtr ItemSkeletalMesh; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Mesh, meta = (AllowPrivateAccess = "true")) - class UStaticMeshComponent* ItemStaticMesh; + TObjectPtr ItemStaticMesh; protected: UPROPERTY(VisibleAnywhere, BlueprintReadWrite) bool bIsEquipped; diff --git a/Source/D1/Actor/BaseWeapon.cpp b/Source/D1/Actor/BaseWeapon.cpp index fe4af485..d1d7e16c 100644 --- a/Source/D1/Actor/BaseWeapon.cpp +++ b/Source/D1/Actor/BaseWeapon.cpp @@ -97,6 +97,16 @@ float ABaseWeapon::GetDamage() return outDamage; } +void ABaseWeapon::ActivateCollision(ECollisionPart CollisionPart) +{ + CollisionComponent->ActivateCollision(); +} + +void ABaseWeapon::DeactivateCollision(ECollisionPart CollsionPart) +{ + CollisionComponent->DeactivateCollision(); +} + TArray ABaseWeapon::GetActionMontage(FGameplayTag characterAction) { TArray outputArr; diff --git a/Source/D1/Actor/BaseWeapon.h b/Source/D1/Actor/BaseWeapon.h index 98d75e45..76aa76a3 100644 --- a/Source/D1/Actor/BaseWeapon.h +++ b/Source/D1/Actor/BaseWeapon.h @@ -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 GetActionMontage(FGameplayTag characterAction); diff --git a/Source/D1/CombatCharacter.cpp b/Source/D1/CombatCharacter.cpp index f88b4345..88ba450e 100644 --- a/Source/D1/CombatCharacter.cpp +++ b/Source/D1/CombatCharacter.cpp @@ -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(); @@ -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() } - diff --git a/Source/D1/CombatCharacter.h b/Source/D1/CombatCharacter.h index aab44971..c548dd3c 100644 --- a/Source/D1/CombatCharacter.h +++ b/Source/D1/CombatCharacter.h @@ -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 CombatComponent; @@ -194,5 +198,6 @@ private: bool IsHeavyAttack; float AttackHeldTime; bool bAttackCharged; + bool bCanMove = true; }; diff --git a/Source/D1/Components/CollisionComponent.cpp b/Source/D1/Components/CollisionComponent.cpp index 7b36aabe..27d4c191 100644 --- a/Source/D1/Components/CollisionComponent.cpp +++ b/Source/D1/Components/CollisionComponent.cpp @@ -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; diff --git a/Source/D1/Components/CollisionComponent.h b/Source/D1/Components/CollisionComponent.h index 72fe8ab1..0ae3ae00 100644 --- a/Source/D1/Components/CollisionComponent.h +++ b/Source/D1/Components/CollisionComponent.h @@ -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 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")) diff --git a/Source/D1/Definitions/GameEnums.h b/Source/D1/Definitions/GameEnums.h index cd171eb4..c49b1e15 100644 --- a/Source/D1/Definitions/GameEnums.h +++ b/Source/D1/Definitions/GameEnums.h @@ -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"), +}; + diff --git a/Source/D1/Interface/CombatInterface.h b/Source/D1/Interface/CombatInterface.h index 32e39c46..63fcf2e9 100644 --- a/Source/D1/Interface/CombatInterface.h +++ b/Source/D1/Interface/CombatInterface.h @@ -32,4 +32,6 @@ public: FRotator GetDesiredRotation(); UFUNCTION(BlueprintCallable, BlueprintNativeEvent) bool CanReceiveDamage(); + UFUNCTION(BlueprintCallable, BlueprintNativeEvent) + void SetCanMove(bool inputCanMove); };