Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Private/NavigationInvokerComponent.cpp
T

61 lines
1.4 KiB
C++
Raw Normal View History

2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2015-01-27 12:27:27 -05:00
#include "NavigationInvokerComponent.h"
#include "NavigationSystem.h"
2015-01-27 12:27:27 -05: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;
SupportedAgents.MarkInitialized();
2015-01-27 12:27:27 -05:00
}
void UNavigationInvokerComponent::Activate(bool bReset)
{
Super::Activate(bReset);
AActor* Owner = GetOwner();
if (Owner)
{
UNavigationSystemV1::RegisterNavigationInvoker(*Owner, TileGenerationRadius, TileRemovalRadius, SupportedAgents);
2015-01-27 12:27:27 -05:00
}
}
void UNavigationInvokerComponent::Deactivate()
{
Super::Deactivate();
AActor* Owner = GetOwner();
if (Owner)
{
UNavigationSystemV1::UnregisterNavigationInvoker(*Owner);
2015-01-27 12:27:27 -05:00
}
}
void UNavigationInvokerComponent::PostInitProperties()
{
Super::PostInitProperties();
SupportedAgents.MarkInitialized();
}
void UNavigationInvokerComponent::RegisterWithNavigationSystem(UNavigationSystemV1& NavSys)
2015-01-27 12:27:27 -05:00
{
if (IsActive())
{
AActor* Owner = GetOwner();
if (Owner)
{
NavSys.RegisterInvoker(*Owner, TileGenerationRadius, TileRemovalRadius, SupportedAgents);
2015-01-27 12:27:27 -05:00
}
}
}
void UNavigationInvokerComponent::SetGenerationRadii(const float GenerationRadius, const float RemovalRadius)
{
TileGenerationRadius = GenerationRadius;
TileRemovalRadius = RemovalRadius;
}