Switch VampireAIController to using CrowdFollowingComponent

This commit is contained in:
baz 2024-08-25 03:02:07 +01:00
parent f6bbc7e8f0
commit 2959c68ffe
3 changed files with 13 additions and 5 deletions

BIN
Content/Enemy/BP_AIController.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -4,11 +4,11 @@
#include "VampireAIController.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Components/CapsuleComponent.h"
#include "GameFramework/PawnMovementComponent.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"));
BehaviorTree = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("Behavior Tree"));
@ -18,6 +18,13 @@ void AVampireAIController::BeginPlay()
{
Super::BeginPlay();
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)

View File

@ -4,6 +4,7 @@
#include "CoreMinimal.h"
#include "AIController.h"
#include "DetourCrowdAIController.h"
#include "EnemyCharacter.h"
#include "HealthComponent.h"
#include "PlayerCharacter.h"