[박치영] Gruntling Monster 작업 완료
parent
5b55cfbd79
commit
1556d20ba1
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "AI/BehaviorTreeNodes/T_FindRepositionLocation.h"
|
||||
|
||||
#include "BehaviorTree/BlackboardComponent.h"
|
||||
#include "NavigationSystem.h"
|
||||
|
||||
EBTNodeResult::Type UT_FindRepositionLocation::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
|
||||
{
|
||||
EBTNodeResult::Type result = Super::ExecuteTask(OwnerComp, NodeMemory);
|
||||
if(result == EBTNodeResult::Failed)
|
||||
return EBTNodeResult::Failed;
|
||||
|
||||
BlackboardComponent = OwnerComp.GetBlackboardComponent();
|
||||
if(BlackboardComponent == nullptr)
|
||||
return EBTNodeResult::Failed;
|
||||
|
||||
UObject* pObj = BlackboardComponent->GetValueAsObject(BlackboardKey_TargetToFollow.SelectedKeyName);
|
||||
if(pObj)
|
||||
{
|
||||
AActor* OwnedActor = Cast<AActor>(pObj);
|
||||
if(OwnedActor)
|
||||
{
|
||||
UNavigationSystemV1* navSystem = UNavigationSystemV1::GetNavigationSystem(GetWorld());
|
||||
if(navSystem)
|
||||
{
|
||||
FNavLocation outLavLocation;
|
||||
navSystem->GetRandomReachablePointInRadius(OwnedActor->GetActorLocation(), RadiusRange, outLavLocation);
|
||||
BlackboardComponent->SetValueAsVector(BlackboardKey_MoveToLocation.SelectedKeyName, outLavLocation.Location);
|
||||
return EBTNodeResult::Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
return EBTNodeResult::Failed;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "BehaviorTree/BTTaskNode.h"
|
||||
#include "T_FindRepositionLocation.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class D1_API UT_FindRepositionLocation : public UBTTaskNode
|
||||
{
|
||||
GENERATED_BODY()
|
||||
protected:
|
||||
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
|
||||
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="BlackBoard", meta=(AllowPrivateAccess="true"))
|
||||
FBlackboardKeySelector BlackboardKey_TargetToFollow;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="BlackBoard", meta=(AllowPrivateAccess="true"))
|
||||
FBlackboardKeySelector BlackboardKey_MoveToLocation;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="BlackBoard", meta=(AllowPrivateAccess="true"))
|
||||
float RadiusRange;
|
||||
private:
|
||||
TObjectPtr<UBlackboardComponent> BlackboardComponent;
|
||||
};
|
|
@ -54,15 +54,15 @@ void AGruntlingEnemy::BeginPlay()
|
|||
MainWeaponCollisionComponent->SetCollisionMeshComponent(WeaponMeshComponent);
|
||||
MainWeaponCollisionComponent->AddActorToIgnore(this);
|
||||
|
||||
if(APlayerController* playerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
|
||||
UUI_HealthBar* HealthBarRef = Cast<UUI_HealthBar>(HealthBarComponent->GetWidget());
|
||||
if (HealthBarRef) //ExposeOnSpawn 대용으로 사용
|
||||
{
|
||||
UUI_HealthBar* HealthBarRef = Cast<UUI_HealthBar>(HealthBarComponent->GetWidget());
|
||||
if(HealthBarRef) //ExposeOnSpawn 대용으로 사용
|
||||
{
|
||||
HealthBarRef->InitializeHealthBar(this->StatsComponent, EStats::Health);
|
||||
HealthBarComponent->SetWidget(HealthBarRef);
|
||||
}
|
||||
HealthBarRef->InitializeHealthBar(this->StatsComponent, EStats::Health);
|
||||
HealthBarComponent->SetWidget(HealthBarRef);
|
||||
}
|
||||
|
||||
if(IsValid(IntroAnimMontage))
|
||||
PlayAnimMontage(IntroAnimMontage);
|
||||
}
|
||||
|
||||
void AGruntlingEnemy::OnTargeted(bool bIsTargeted)
|
||||
|
|
|
@ -44,4 +44,6 @@ private:
|
|||
FName AttachSocketName;
|
||||
UPROPERTY(EditAnywhere, Blueprintable, Category="Initialization", meta=(AllowPrivateAccess="true"))
|
||||
FName WeaponHandSocketName;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Montage|Intro", meta = (AllowPrivateAccess = "true"))
|
||||
TObjectPtr<UAnimMontage> IntroAnimMontage;
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "AI/MasterAI.h"
|
||||
|
||||
#include "AIController.h"
|
||||
#include "CombatPlayerController.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "Components/InputComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
@ -274,6 +273,7 @@ float AMasterAI::PerformAttack(FGameplayTag AttackType, int32 AttackIndex, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
RotateToTarget();
|
||||
StateManagerComponent->SetCurrentState(FCombatGameplayTags::Get().Character_State_Attacking);
|
||||
StateManagerComponent->SetCurrentAction(AttackType);
|
||||
|
||||
|
@ -333,9 +333,7 @@ void AMasterAI::CharacterStateBegin(FGameplayTag CharState)
|
|||
if (FGameplayTag::EmptyTag == CharState)
|
||||
{/*None*/}
|
||||
else if (FCombatGameplayTags::Get().Character_State_Attacking == CharState)
|
||||
{
|
||||
RotateToTarget();
|
||||
}
|
||||
{/*None*/}
|
||||
else if (FCombatGameplayTags::Get().Character_State_Dodging == CharState)
|
||||
{/*None*/}
|
||||
else if (FCombatGameplayTags::Get().Character_State_GeneralActionState == CharState)
|
||||
|
@ -470,7 +468,6 @@ void AMasterAI::RotateToTargetUpdate(float Value)
|
|||
if(!IsValid(TargetActor))
|
||||
return;
|
||||
|
||||
|
||||
const FRotator CurrentRotator = GetActorRotation();
|
||||
FVector StartVector = GetActorLocation();
|
||||
FVector TargetVector = TargetActor->GetActorLocation();
|
||||
|
@ -479,7 +476,6 @@ void AMasterAI::RotateToTargetUpdate(float Value)
|
|||
UWorld* WorldPointer = GetWorld();
|
||||
if(!WorldPointer)
|
||||
return;
|
||||
double deltaTime = UGameplayStatics::GetWorldDeltaSeconds(WorldPointer);
|
||||
FRotator NewRotator = FMath::Lerp<FRotator, float>(CurrentRotator, TargetRotator, Value);
|
||||
NewRotator.Roll = CurrentRotator.Roll;
|
||||
NewRotator.Pitch = CurrentRotator.Pitch;
|
||||
|
|
Loading…
Reference in New Issue