Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavigationPath.h
Stephen Holmes ef0154ac65 Upgraded a lot of the navigation code. to use FVector::FReal rather than floats. Areas of code where there was little to gain from doing this but would break existing code have been left as float.
#review-22090184
#jira UE-159397
#preflight 632af1846919ce3998bd2195

[CL 22111650 by Stephen Holmes in ue5-main branch]
2022-09-21 09:16:42 -04:00

88 lines
2.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "NavigationData.h"
#include "NavigationPath.generated.h"
class APlayerController;
class UCanvas;
class UNavigationPath;
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnNavigationPathUpdated, UNavigationPath*, AffectedPath, TEnumAsByte<ENavPathEvent::Type>, PathEvent);
/**
* UObject wrapper for FNavigationPath
*/
UCLASS(BlueprintType)
class NAVIGATIONSYSTEM_API UNavigationPath : public UObject
{
GENERATED_UCLASS_BODY()
UPROPERTY(BlueprintAssignable)
FOnNavigationPathUpdated PathUpdatedNotifier;
UPROPERTY(BlueprintReadOnly, Category = Navigation)
TArray<FVector> PathPoints;
UPROPERTY(BlueprintReadOnly, Category = Navigation)
TEnumAsByte<ENavigationOptionFlag::Type> RecalculateOnInvalidation;
private:
uint32 bIsValid : 1;
uint32 bDebugDrawingEnabled : 1;
FColor DebugDrawingColor;
FDelegateHandle DrawDebugDelegateHandle;
protected:
FNavPathSharedPtr SharedPath;
FNavigationPath::FPathObserverDelegate::FDelegate PathObserver;
FDelegateHandle PathObserverDelegateHandle;
public:
// UObject begin
virtual void BeginDestroy() override;
// UObject end
UFUNCTION(BlueprintCallable, Category = "AI|Debug")
FString GetDebugString() const;
UFUNCTION(BlueprintCallable, Category = "AI|Debug")
void EnableDebugDrawing(bool bShouldDrawDebugData, FLinearColor PathColor = FLinearColor::White);
/** if enabled path will request recalculation if it gets invalidated due to a change to underlying navigation */
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
void EnableRecalculationOnInvalidation(TEnumAsByte<ENavigationOptionFlag::Type> DoRecalculation);
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
double GetPathLength() const;
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
double GetPathCost() const;
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
bool IsPartial() const;
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
bool IsValid() const;
UFUNCTION(BlueprintCallable, Category = "AI|Navigation")
bool IsStringPulled() const;
void SetPath(FNavPathSharedPtr NewSharedPath);
FNavPathSharedPtr GetPath() { return SharedPath; }
protected:
void DrawDebug(UCanvas* Canvas, APlayerController*);
void OnPathEvent(FNavigationPath* Path, ENavPathEvent::Type PathEvent);
void SetPathPointsFromPath(FNavigationPath& NativePath);
};