2019-12-26 14:45:42 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2015-01-27 12:27:27 -05:00
|
|
|
|
2018-03-27 14:27:07 -04:00
|
|
|
#include "NavigationInvokerComponent.h"
|
|
|
|
|
#include "NavigationSystem.h"
|
2015-01-27 12:27:27 -05:00
|
|
|
|
2022-09-24 13:57:58 -04:00
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(NavigationInvokerComponent)
|
|
|
|
|
|
2015-01-27 12:27:27 -05:00
|
|
|
UNavigationInvokerComponent::UNavigationInvokerComponent(const FObjectInitializer& ObjectInitializer)
|
|
|
|
|
: Super(ObjectInitializer)
|
|
|
|
|
, TileGenerationRadius(3000)
|
|
|
|
|
, TileRemovalRadius(5000)
|
|
|
|
|
{
|
|
|
|
|
bAutoActivate = true;
|
2023-01-11 20:55:27 -05:00
|
|
|
SupportedAgents.MarkInitialized();
|
2015-01-27 12:27:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UNavigationInvokerComponent::Activate(bool bReset)
|
|
|
|
|
{
|
|
|
|
|
Super::Activate(bReset);
|
|
|
|
|
|
|
|
|
|
AActor* Owner = GetOwner();
|
|
|
|
|
if (Owner)
|
|
|
|
|
{
|
2023-01-11 20:55:27 -05:00
|
|
|
UNavigationSystemV1::RegisterNavigationInvoker(*Owner, TileGenerationRadius, TileRemovalRadius, SupportedAgents);
|
2015-01-27 12:27:27 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UNavigationInvokerComponent::Deactivate()
|
|
|
|
|
{
|
|
|
|
|
Super::Deactivate();
|
|
|
|
|
|
|
|
|
|
AActor* Owner = GetOwner();
|
|
|
|
|
if (Owner)
|
|
|
|
|
{
|
2018-03-27 14:27:07 -04:00
|
|
|
UNavigationSystemV1::UnregisterNavigationInvoker(*Owner);
|
2015-01-27 12:27:27 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-11 20:55:27 -05:00
|
|
|
void UNavigationInvokerComponent::PostInitProperties()
|
|
|
|
|
{
|
|
|
|
|
Super::PostInitProperties();
|
|
|
|
|
SupportedAgents.MarkInitialized();
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-27 14:27:07 -04:00
|
|
|
void UNavigationInvokerComponent::RegisterWithNavigationSystem(UNavigationSystemV1& NavSys)
|
2015-01-27 12:27:27 -05:00
|
|
|
{
|
|
|
|
|
if (IsActive())
|
|
|
|
|
{
|
|
|
|
|
AActor* Owner = GetOwner();
|
|
|
|
|
if (Owner)
|
|
|
|
|
{
|
2023-01-11 20:55:27 -05:00
|
|
|
NavSys.RegisterInvoker(*Owner, TileGenerationRadius, TileRemovalRadius, SupportedAgents);
|
2015-01-27 12:27:27 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-15 13:13:20 -04:00
|
|
|
|
|
|
|
|
void UNavigationInvokerComponent::SetGenerationRadii(const float GenerationRadius, const float RemovalRadius)
|
|
|
|
|
{
|
|
|
|
|
TileGenerationRadius = GenerationRadius;
|
|
|
|
|
TileRemovalRadius = RemovalRadius;
|
2023-01-11 20:55:27 -05:00
|
|
|
}
|