You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Added virtual method INavLinkCustomInterface::GetSupportedAgents to allow derived classes to provide their supported agents when a NavigationLink is created by INavLinkCustomInterface::GetModifier. Added property SupportedAgents to NavLinkCustomComponent and override GetSupportedAgents to forward the filter to the NavigationLink. #jira UE-74364 #review-6523922 @mieszko.zielinski #rb mieszko.zielinski [CL 6533612 by Yoan StAmant in Dev-Framework branch]
81 lines
2.9 KiB
C++
81 lines
2.9 KiB
C++
// Copyright 1998-2019 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"
|
|
#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
|
|
{
|
|
GENERATED_UINTERFACE_BODY()
|
|
};
|
|
|
|
class NAVIGATIONSYSTEM_API INavLinkCustomInterface
|
|
{
|
|
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();
|
|
|
|
/** 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);
|
|
|
|
static uint32 NextUniqueId;
|
|
};
|