diff --git a/Content/CombatSystem/Blueprints/AI/BB_Base.uasset b/Content/CombatSystem/Blueprints/AI/BB_Base.uasset index 6732cb99..933b0c84 100644 Binary files a/Content/CombatSystem/Blueprints/AI/BB_Base.uasset and b/Content/CombatSystem/Blueprints/AI/BB_Base.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing.uasset index c4d2d363..2e155403 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing_Montage.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing_Montage.uasset new file mode 100644 index 00000000..c754710b Binary files /dev/null and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Attacks/Gruntling_Sword_Attack_Swing_Montage.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Run.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Run.uasset index 43eda30e..074371a9 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Run.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Run.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk.uasset index 58a7ba98..41a620d4 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk_Slow.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk_Slow.uasset index 6837db41..f519e507 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk_Slow.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/ExoGame_Gruntling_Walk_Slow.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/Idle_Grunt.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/Idle_Grunt.uasset index b235b2b5..250be8f9 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/Idle_Grunt.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/Animations/Locomotion/Idle_Grunt.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BP_GruntlingEnemy.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BP_GruntlingEnemy.uasset index e97ad578..b666de46 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BP_GruntlingEnemy.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BP_GruntlingEnemy.uasset differ diff --git a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BT_GruntlingEnemy.uasset b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BT_GruntlingEnemy.uasset index e8d5b051..06df8a12 100644 Binary files a/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BT_GruntlingEnemy.uasset and b/Content/CombatSystem/Blueprints/AI/GruntlingEnemy/BT_GruntlingEnemy.uasset differ diff --git a/Content/Maps/IceLandMap.umap b/Content/Maps/IceLandMap.umap index b3f0b7df..4e45b1db 100644 Binary files a/Content/Maps/IceLandMap.umap and b/Content/Maps/IceLandMap.umap differ diff --git a/Source/D1/AI/BehaviorTreeNodes/S_UpdateBehavior.cpp b/Source/D1/AI/BehaviorTreeNodes/S_UpdateBehavior.cpp index c2bb7851..48107544 100644 --- a/Source/D1/AI/BehaviorTreeNodes/S_UpdateBehavior.cpp +++ b/Source/D1/AI/BehaviorTreeNodes/S_UpdateBehavior.cpp @@ -40,12 +40,9 @@ void US_UpdateBehavior::UpdateBehavior() { if(!IsValid(ControlledMasterAI) || !IsValid(OwnerController)) return; - UStateManagerComponent* StateManagerComponent = ControlledMasterAI->GetComponentByClass(); - if(!StateManagerComponent) - return; - if(StateManagerComponent->GetCurrentState() == FCombatGameplayTags::Get().Character_State_Dead) + if(ControlledMasterAI->IsDead()) { - SetBehavior(EAIBehavior::Nothing); + SetBehavior(EAIBehavior::Death); return; } diff --git a/Source/D1/AI/MasterAI.cpp b/Source/D1/AI/MasterAI.cpp index 780f617b..4d4e2102 100644 --- a/Source/D1/AI/MasterAI.cpp +++ b/Source/D1/AI/MasterAI.cpp @@ -2,6 +2,9 @@ #include "AI/MasterAI.h" + +#include "AIController.h" +#include "CombatPlayerController.h" #include "Components/CapsuleComponent.h" #include "Components/InputComponent.h" #include "GameFramework/CharacterMovementComponent.h" @@ -12,6 +15,7 @@ #include "Definitions/CombatGameplayTags.h" #include "Engine/DamageEvents.h" #include "NiagaraFunctionLibrary.h" +#include "BehaviorTree/BlackboardComponent.h" #include "Components/CollisionComponent.h" #include "Components/TimelineComponent.h" #include "Components/WidgetComponent.h" @@ -484,6 +488,10 @@ void AMasterAI::RotateToTargetUpdate(float Value) void AMasterAI::PerformDeath() { + if(IsDead()) + return; + SetDead(true); + if(!DeathAnimations.IsEmpty()) { const int randomIdx = FMath::RandRange(0, DeathAnimations.Num() - 1); @@ -496,6 +504,8 @@ void AMasterAI::PerformDeath() ApplyHitReactionPhysicsVelocity(2000.f); else ApplyHitReactionPhysicsVelocity(-2000.f); + + GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap); FTimerHandle deathTimer; GetWorld()->GetTimerManager().SetTimer(deathTimer, FTimerDelegate::CreateLambda([&]() @@ -592,6 +602,8 @@ bool AMasterAI::CanReceiveHitReaction() inputContainer.AddTag(FCombatGameplayTags::Get().Character_State_Dead); ReturnValue &= !StateManagerComponent->IsCurrentStateEqualToAny(inputContainer); + ReturnValue &= !IsDead(); + return ReturnValue; } @@ -630,3 +642,23 @@ TArray AMasterAI::GetActionMontage(FGameplayTag characterAction) return outputArr; } + +void AMasterAI::SetDead(bool Condition) +{ + if(bIsDead == Condition) + return; + + bIsDead = Condition; + AAIController* aiController = Cast(GetController()); + if(aiController) + { + UBlackboardComponent* BlackboardComponent = aiController->GetBlackboardComponent(); + if(BlackboardComponent) + BlackboardComponent->SetValueAsBool(TEXT("bIsDead"), bIsDead); + } +} + +bool AMasterAI::IsDead() +{ + return bIsDead; +} \ No newline at end of file diff --git a/Source/D1/AI/MasterAI.h b/Source/D1/AI/MasterAI.h index e26e6193..070af81e 100644 --- a/Source/D1/AI/MasterAI.h +++ b/Source/D1/AI/MasterAI.h @@ -97,6 +97,7 @@ private: void SprintStaminaCost(); void ApplyHitReaction(EDamageType InDamageType); void ApplyImpactEffect(EDamageType InDamageType); + //Timeline void RotateToTarget(); @@ -117,10 +118,12 @@ protected: //Check Func bool CanPerformSprint(); FGameplayTag GetDesiredAttackType(); TArray GetActionMontage(FGameplayTag characterAction); - -public: //Getter + +public: //Getter, Setter FORCEINLINE class UBehaviorTree* GetBeHaviorTree() {return BehaviorTree;} FORCEINLINE const TArray& GetPatrolPoints() { return PatrolPoints; } + void SetDead(bool Condition); + bool IsDead(); private: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Initialization", meta=(AllowPrivateAccess="true")) @@ -183,6 +186,7 @@ private: bool bCanMove = true; bool bHitFront; bool bEnableIFrame; + bool bIsDead; FHitResult LastHitInfo; UPROPERTY() diff --git a/Source/D1/CombatPlayerCharacter.cpp b/Source/D1/CombatPlayerCharacter.cpp index 2dd1aecb..44c7a647 100644 --- a/Source/D1/CombatPlayerCharacter.cpp +++ b/Source/D1/CombatPlayerCharacter.cpp @@ -623,7 +623,9 @@ void ACombatPlayerCharacter::AttackEvent() void ACombatPlayerCharacter::ChargeAttackEvent() { - if (CanPerformAttack()) + if (!CanPerformAttack()) + return; + if(CombatComponent->GetCombatEnabled()) { PerformAttack(FCombatGameplayTags::Get().Character_Action_Attack_ChargedAttack, CombatComponent->GetAttackCount()); ABaseWeapon* pBaseWeapon = CombatComponent->GetMainWeapon(); diff --git a/Source/D1/Definitions/GameEnums.h b/Source/D1/Definitions/GameEnums.h index ed9829af..cadef3ce 100644 --- a/Source/D1/Definitions/GameEnums.h +++ b/Source/D1/Definitions/GameEnums.h @@ -45,6 +45,7 @@ enum class EAIBehavior : uint8 Chase UMETA(DisplayName = "Chase"), Patrol UMETA(DisplayName = "Patrol"), Hit UMETA(DisplayName = "Hit"), + Death UMETA(DisplayName = "Death"), }; UENUM(BlueprintType)