本文整理汇总了C++中AAIController::GetPathFollowingComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ AAIController::GetPathFollowingComponent方法的具体用法?C++ AAIController::GetPathFollowingComponent怎么用?C++ AAIController::GetPathFollowingComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AAIController
的用法示例。
在下文中一共展示了AAIController::GetPathFollowingComponent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AbortTask
EBTNodeResult::Type UBTTask_MoveDirectlyToward::AbortTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory)
{
FBTMoveDirectlyTowardMemory* MyMemory = reinterpret_cast<FBTMoveDirectlyTowardMemory*>(NodeMemory);
AAIController* MyController = OwnerComp.GetAIOwner();
if (MyController && MyController->GetPathFollowingComponent())
{
MyController->GetPathFollowingComponent()->AbortMove(TEXT("BehaviorTree abort"), MyMemory->MoveRequestID);
}
return Super::AbortTask(OwnerComp, NodeMemory);
}
示例2: CalculateRawConditionValue
bool UBTDecorator_IsAtLocation::CalculateRawConditionValue(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) const
{
bool bHasReached = false;
AAIController* AIOwner = OwnerComp.GetAIOwner();
UPathFollowingComponent* PathFollowingComponent = AIOwner ? AIOwner->GetPathFollowingComponent() : nullptr;
if (PathFollowingComponent)
{
const UBlackboardComponent* MyBlackboard = OwnerComp.GetBlackboardComponent();
if (BlackboardKey.SelectedKeyType == UBlackboardKeyType_Object::StaticClass())
{
UObject* KeyValue = MyBlackboard->GetValue<UBlackboardKeyType_Object>(BlackboardKey.GetSelectedKeyID());
AActor* TargetActor = Cast<AActor>(KeyValue);
if (TargetActor)
{
bHasReached = PathFollowingComponent->HasReached(*TargetActor, AcceptableRadius, false, bUseNavAgentGoalLocation);
}
}
else if (BlackboardKey.SelectedKeyType == UBlackboardKeyType_Vector::StaticClass())
{
const FVector TargetLocation = MyBlackboard->GetValue<UBlackboardKeyType_Vector>(BlackboardKey.GetSelectedKeyID());
if (FAISystem::IsValidLocation(TargetLocation))
{
bHasReached = PathFollowingComponent->HasReached(TargetLocation, AcceptableRadius);
}
}
}
return bHasReached;
}
示例3: End
void C_DudeMoveTo::End()
{
if (cbHandle.IsValid())
{
AAIController* controller = CastChecked<AAIController>(m_Dude.GetController());
controller->GetPathFollowingComponent()->OnMoveFinished.Remove(cbHandle);
cbHandle.Reset();
}
}
示例4: UnlockAIResourcesWithAnimation
void UAIBlueprintHelperLibrary::UnlockAIResourcesWithAnimation(UAnimInstance* AnimInstance, bool bUnlockMovement, bool UnlockAILogic)
{
if (AnimInstance == NULL)
{
return;
}
APawn* PawnOwner = AnimInstance->TryGetPawnOwner();
if (PawnOwner)
{
AAIController* OwningAI = Cast<AAIController>(PawnOwner->Controller);
if (OwningAI)
{
if (bUnlockMovement && OwningAI->GetPathFollowingComponent())
{
OwningAI->GetPathFollowingComponent()->ClearResourceLock(EAIRequestPriority::HardScript);
}
if (UnlockAILogic && OwningAI->BrainComponent)
{
OwningAI->BrainComponent->ClearResourceLock(EAIRequestPriority::HardScript);
}
}
}
}
示例5: Start
//========================================================================
void C_DudeMoveTo::Start()
{
AAIController* controller = CastChecked<AAIController>(m_Dude.GetController());
auto ret = controller->MoveToLocation(target, -1.f, true, true, false, true, 0, false); //do not allow partial paths!
if (ret == EPathFollowingRequestResult::Failed)
{
m_Dude.ClearActionQueue();
cbHandle.Reset();
}
else
{
cbHandle = controller->GetPathFollowingComponent()->OnMoveFinished.AddRaw(this, &C_DudeMoveTo::OnMoveCompleted);
}
}