Switch VampireAIController to using CrowdFollowingComponent
This commit is contained in:
parent
f6bbc7e8f0
commit
2959c68ffe
BIN
Content/Enemy/BP_AIController.uasset (Stored with Git LFS)
BIN
Content/Enemy/BP_AIController.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -4,11 +4,11 @@
|
||||||
#include "VampireAIController.h"
|
#include "VampireAIController.h"
|
||||||
|
|
||||||
#include "BehaviorTree/BlackboardComponent.h"
|
#include "BehaviorTree/BlackboardComponent.h"
|
||||||
#include "Components/CapsuleComponent.h"
|
|
||||||
#include "GameFramework/PawnMovementComponent.h"
|
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "Navigation/CrowdFollowingComponent.h"
|
||||||
|
|
||||||
AVampireAIController::AVampireAIController(const FObjectInitializer& object_initializer)
|
AVampireAIController::AVampireAIController(const FObjectInitializer& object_initializer) : Super(
|
||||||
|
object_initializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("Path Following Component")))
|
||||||
{
|
{
|
||||||
Blackboard = CreateDefaultSubobject<UBlackboardComponent>(TEXT("Blackboard"));
|
Blackboard = CreateDefaultSubobject<UBlackboardComponent>(TEXT("Blackboard"));
|
||||||
BehaviorTree = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("Behavior Tree"));
|
BehaviorTree = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("Behavior Tree"));
|
||||||
|
@ -18,6 +18,13 @@ void AVampireAIController::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
GetWorldTimerManager().SetTimer(PawnMoveToTimerHandle, this, &AVampireAIController::PawnMoveTo, 0.25f, true);
|
GetWorldTimerManager().SetTimer(PawnMoveToTimerHandle, this, &AVampireAIController::PawnMoveTo, 0.25f, true);
|
||||||
|
|
||||||
|
if (UCrowdFollowingComponent* CrowdFollowingComponent = FindComponentByClass<UCrowdFollowingComponent>())
|
||||||
|
{
|
||||||
|
CrowdFollowingComponent->SetCrowdSeparation(true);
|
||||||
|
CrowdFollowingComponent->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Good);
|
||||||
|
CrowdFollowingComponent->SetCrowdSeparationWeight(10.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AVampireAIController::Tick(float DeltaTime)
|
void AVampireAIController::Tick(float DeltaTime)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "AIController.h"
|
#include "AIController.h"
|
||||||
|
#include "DetourCrowdAIController.h"
|
||||||
#include "EnemyCharacter.h"
|
#include "EnemyCharacter.h"
|
||||||
#include "HealthComponent.h"
|
#include "HealthComponent.h"
|
||||||
#include "PlayerCharacter.h"
|
#include "PlayerCharacter.h"
|
||||||
|
|
Loading…
Reference in New Issue