[박치영] Gruntling Enemy 추가 작업중

main
PCYPC\pcy35 2023-09-11 20:04:04 +09:00
parent 87eba72318
commit 5b55cfbd79
15 changed files with 44 additions and 8 deletions

Binary file not shown.

View File

@ -40,12 +40,9 @@ void US_UpdateBehavior::UpdateBehavior()
{
if(!IsValid(ControlledMasterAI) || !IsValid(OwnerController))
return;
UStateManagerComponent* StateManagerComponent = ControlledMasterAI->GetComponentByClass<UStateManagerComponent>();
if(!StateManagerComponent)
return;
if(StateManagerComponent->GetCurrentState() == FCombatGameplayTags::Get().Character_State_Dead)
if(ControlledMasterAI->IsDead())
{
SetBehavior(EAIBehavior::Nothing);
SetBehavior(EAIBehavior::Death);
return;
}

View File

@ -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<UAnimMontage*> AMasterAI::GetActionMontage(FGameplayTag characterAction)
return outputArr;
}
void AMasterAI::SetDead(bool Condition)
{
if(bIsDead == Condition)
return;
bIsDead = Condition;
AAIController* aiController = Cast<AAIController>(GetController());
if(aiController)
{
UBlackboardComponent* BlackboardComponent = aiController->GetBlackboardComponent();
if(BlackboardComponent)
BlackboardComponent->SetValueAsBool(TEXT("bIsDead"), bIsDead);
}
}
bool AMasterAI::IsDead()
{
return bIsDead;
}

View File

@ -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<UAnimMontage*> GetActionMontage(FGameplayTag characterAction);
public: //Getter
public: //Getter, Setter
FORCEINLINE class UBehaviorTree* GetBeHaviorTree() {return BehaviorTree;}
FORCEINLINE const TArray<ATargetPoint*>& 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()

View File

@ -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();

View File

@ -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)