diff --git a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset index be2604fa..4aecd32d 100644 Binary files a/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset and b/Content/CombatSystem/Blueprints/BP_CombatCharacter.uasset differ diff --git a/Content/CombatSystem/CourseFiles/SoundFX/Gruntling/A_Guardian_Impact_Cue.uasset b/Content/CombatSystem/CourseFiles/SoundFX/Gruntling/A_Guardian_Impact_Cue.uasset new file mode 100644 index 00000000..450efe7b Binary files /dev/null and b/Content/CombatSystem/CourseFiles/SoundFX/Gruntling/A_Guardian_Impact_Cue.uasset differ diff --git a/Content/__ExternalActors__/Maps/ThirdPersonMap/7/YS/ZFVZV5RGVXFDJDFNO8TVNW.uasset b/Content/__ExternalActors__/Maps/ThirdPersonMap/7/YS/ZFVZV5RGVXFDJDFNO8TVNW.uasset index bb1604a7..7da89d1a 100644 Binary files a/Content/__ExternalActors__/Maps/ThirdPersonMap/7/YS/ZFVZV5RGVXFDJDFNO8TVNW.uasset and b/Content/__ExternalActors__/Maps/ThirdPersonMap/7/YS/ZFVZV5RGVXFDJDFNO8TVNW.uasset differ diff --git a/Source/D1/CombatCharacter.cpp b/Source/D1/CombatCharacter.cpp index 8821c2b2..935f87e7 100644 --- a/Source/D1/CombatCharacter.cpp +++ b/Source/D1/CombatCharacter.cpp @@ -67,11 +67,6 @@ ACombatCharacter::ACombatCharacter() Health = 100.f; PelvisBoneName = TEXT("pelvis"); - - //³ªÁß¿¡ ¼öÁ¤ÇÒ ¼ö ÀÖÀ½ - static ConstructorHelpers::FObjectFinder findHitMontage(TEXT("/Script/Engine.AnimMontage'/Game/CombatSystem/CourseFiles/Animations/HitReactions/Standing_React_Large_Front_Montage.Standing_React_Large_Front_Montage'")); - if (findHitMontage.Succeeded()) - HitMontage = findHitMontage.Object; } void ACombatCharacter::BeginPlay() @@ -107,14 +102,15 @@ float ACombatCharacter::TakeDamage(float Damage, FDamageEvent const& DamageEvent CharacterTakeDamage(fDamage); - //TODO : Sound, Effect Emitter, Play anim montage - //static void PlaySoundAtLocation( - // const UObject * WorldContextObject, USoundBase * Sound, FVector Location, - // float VolumeMultiplier = 1.f, float PitchMultiplier = 1.f, float StartTime = 0.f, - // class USoundAttenuation* AttenuationSettings = nullptr, USoundConcurrency * ConcurrencySettings = nullptr, - // const UInitialActiveSoundParams * InitialParams = nullptr) - //UGameplayStatics::PlaySoundAtLocation(this, HitSound, PointDamageEvent->HitInfo.Location); + //Play Sound + UGameplayStatics::PlaySoundAtLocation(this, HitSound, PointDamageEvent->HitInfo.Location); + + //Hit Effect + UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), HitEmitter, PointDamageEvent->HitInfo.Location); + + //Play Animation PlayAnimMontage(HitMontage); + IsDisabled = true; } return fDamage; @@ -308,13 +304,13 @@ void ACombatCharacter::ApplyHitReactionPhysicsVelocity(float InitialSpeed) void ACombatCharacter::EnableRagdoll() { - GetCharacterMovement()->SetMovementMode(EMovementMode::MOVE_None, 0); - 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); - GetCameraBoom()->bDoCollisionTest = false; - GetMesh()->SetCollisionProfileName(TEXT("ragdoll"), true); + 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); } @@ -370,10 +366,10 @@ void ACombatCharacter::PerformDeath() { IsDead = true; 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([&]() @@ -381,7 +377,7 @@ void ACombatCharacter::PerformDeath() if (IsValid(CombatComponent->GetMainWeapon())) CombatComponent->GetMainWeapon()->Destroy(); this->Destroy(); - }), 4.f, false); + }), 4.f, false); // 4ÃÊ ÈÄ¿¡ object »èÁ¦ } bool ACombatCharacter::CanPerformToggleCombat() diff --git a/Source/D1/CombatCharacter.h b/Source/D1/CombatCharacter.h index b198af4b..b3164ac9 100644 --- a/Source/D1/CombatCharacter.h +++ b/Source/D1/CombatCharacter.h @@ -102,6 +102,7 @@ private: void PerformAttack(int32 attackIndex); void PerformDodge(); + UFUNCTION(BlueprintCallable) //Àӽà void PerformDeath(); bool CanPerformToggleCombat(); @@ -115,19 +116,26 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Weapon", meta = (AllowPrivateAccess = "true")) TSubclassOf Weapon; - UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true")) + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true")) FName PelvisBoneName; -private: - //TODO : particle, sound Ãß°¡ - //class USoundWave* HitSound; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true")) TObjectPtr HitMontage; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true")) + TObjectPtr HitSound; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hit", meta = (AllowPrivateAccess = "true")) + TObjectPtr HitEmitter; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Stats", meta = (AllowPrivateAccess = "true")) + float Health; private: bool CombatEnabled; bool IsTogglingCombat; bool IsDodge; bool IsDisabled; bool IsDead; - float Health; + }; diff --git a/Source/D1/Components/CollisionComponent.cpp b/Source/D1/Components/CollisionComponent.cpp index 7b844130..7b36aabe 100644 --- a/Source/D1/Components/CollisionComponent.cpp +++ b/Source/D1/Components/CollisionComponent.cpp @@ -36,12 +36,6 @@ void UCollisionComponent::TickComponent(float DeltaTime, ELevelTick TickType, FA void UCollisionComponent::CollisionTrace() { - //static bool SphereTraceMultiForObjects( -// const UObject * WorldContextObject, const FVector Start, -// const FVector End, float Radius, const TArray > &ObjectTypes, -// bool bTraceComplex, const TArray&ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, -// TArray&OutHits, bool bIgnoreSelf, FLinearColor TraceColor = FLinearColor::Red, -// FLinearColor TraceHitColor = FLinearColor::Green, float DrawTime = 5.0f); FVector StartLocation, EndLocation; StartLocation = CollisionMeshComponent->GetSocketLocation(StartSocketName); EndLocation = CollisionMeshComponent->GetSocketLocation(EndSocketName);