Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavLinkCustomInterface.h
T

85 lines
3.0 KiB
C++
Raw Normal View History

2019-12-26 14:45:42 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "Templates/SubclassOf.h"
#include "UObject/Interface.h"
#include "NavAreas/NavArea.h"
#include "AI/Navigation/NavLinkDefinition.h"
2020-01-27 14:16:56 -05:00
#include "Engine/World.h"
#include "NavLinkCustomInterface.generated.h"
/**
* Interface for custom navigation links
*
* They can affect path finding requests without navmesh rebuilds (e.g. opened/closed doors),
* allows updating their area class without navmesh rebuilds (e.g. dynamic path cost)
* and give hooks for supporting custom movement (e.g. ladders),
*
* Owner is responsible for registering and unregistering links in NavigationSystem:
* - RegisterCustomLink
* - UnregisterCustomLink
*
* See also: NavLinkCustomComponent
*/
UINTERFACE(MinimalAPI, meta=(CannotImplementInterfaceInBlueprint))
class UNavLinkCustomInterface : public UInterface
{
2015-03-17 05:38:32 -04:00
GENERATED_UINTERFACE_BODY()
};
class NAVIGATIONSYSTEM_API INavLinkCustomInterface
{
2015-03-17 05:38:32 -04:00
GENERATED_IINTERFACE_BODY()
/** Get basic link data: two points (relative to owner) and direction */
virtual void GetLinkData(FVector& LeftPt, FVector& RightPt, ENavLinkDirection::Type& Direction) const {};
/** Get agents supported by this link */
virtual void GetSupportedAgents(FNavAgentSelector& OutSupportedAgents) const {};
/** Get basic link data: area class (null = default walkable) */
virtual TSubclassOf<UNavArea> GetLinkAreaClass() const { return nullptr; }
/** Get unique ID number for custom link
* Owner should get its unique ID by calling INavLinkCustomInterface::GetUniqueId() and store it
*/
virtual uint32 GetLinkId() const { return 0; }
/** Update unique ID number for custom link by navigation system */
virtual void UpdateLinkId(uint32 NewUniqueId) { }
/** Get object owner of navigation link, used for creating containers with multiple links */
virtual UObject* GetLinkOwner() const;
/** Check if link allows path finding
* Querier is usually an AIController trying to find path
*/
virtual bool IsLinkPathfindingAllowed(const UObject* Querier) const { return true; }
/** Notify called when agent starts using this link for movement.
* returns true = custom movement, path following will NOT update velocity until FinishUsingCustomLink() is called on it
*/
virtual bool OnLinkMoveStarted(class UObject* PathComp, const FVector& DestPoint) { return false; }
/** Notify called when agent finishes using this link for movement */
virtual void OnLinkMoveFinished(class UObject* PathComp) {}
/** Helper function: returns unique ID number for custom links */
static uint32 GetUniqueId();
2014-07-16 05:53:06 -04:00
/** Helper function: bump unique ID numbers above given one */
static void UpdateUniqueId(uint32 AlreadyUsedId);
/** Helper function: create modifier for navigation data export */
static FNavigationLink GetModifier(const INavLinkCustomInterface* CustomNavLink);
2014-07-16 05:53:06 -04:00
static void OnPreWorldInitialization(UWorld* World, const UWorld::InitializationValues IVS);
static void ResetUniqueId();
2014-07-16 05:53:06 -04:00
static uint32 NextUniqueId;
};