Guest User

Untitled

a guest
Dec 26th, 2023
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. // Copyright 2021 Glass Bottom Games, all rights reserved, also all lefts reserved because Megan Fox is left-handed so it's only right, wait, oh no
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "NavLinkCustomComponent.h"
  7. #include "SurfaceableCustomNavLinkComponent.generated.h"
  8.  
  9. DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FSurfaceableCustomNavLinkReachedSignature, AActor*, MovingActor, const FVector&, DestinationPoint);
  10.  
  11. UCLASS(meta = (BlueprintSpawnableComponent), Classgroup = "Navigation")
  12. class BIRDAHOY_API USurfaceableCustomNavLinkComponent : public UNavLinkCustomComponent
  13. {
  14. GENERATED_BODY()
  15.  
  16. public:
  17.  
  18. #if WITH_EDITOR
  19. virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
  20. #endif // WITH_EDITOR
  21. virtual void OnRegister() override;
  22.  
  23. /**
  24. * @brief Sets default values for this component's properties
  25. * @param ObjectInitializer
  26. */
  27. USurfaceableCustomNavLinkComponent(const FObjectInitializer& ObjectInitializer);
  28.  
  29. UPROPERTY(BlueprintAssignable)
  30. FSurfaceableCustomNavLinkReachedSignature OnSmartLinkReached;
  31.  
  32. void NotifySmartLinkReached(UNavLinkCustomComponent* LinkComp, UObject* PathingAgent, const FVector& DestPoint);
  33.  
  34. /**
  35. * @brief called when agent reaches smart link during path following, use ResumePathFollowing() to give control back
  36. * @param Agent
  37. * @param Destination
  38. */
  39. UFUNCTION(BlueprintImplementableEvent)
  40. void ReceiveSmartLinkReached(AActor* Agent, const FVector& Destination);
  41.  
  42. /** resume normal path following */
  43. UFUNCTION(BlueprintCallable, Category = SmartLink)
  44. void SmartLinkResumePathFollowing(AActor* Agent);
  45.  
  46. /** check if smart link is enabled */
  47. UFUNCTION(BlueprintCallable, Category = SmartLink)
  48. bool IsSmartLinkRelevant() const;
  49.  
  50. /** check if any agent is moving through smart link right now */
  51. UFUNCTION(BlueprintCallable, Category = SmartLink)
  52. bool SmartLinkHasMovingAgents() const;
  53.  
  54. /**
  55. * @brief Assigns data through to the smart link, in a simplified way that BP can interact with
  56. * @param relStartPoint the relative starting point of the link
  57. * @param relEndPoint the relative ending point of the link
  58. * @param bBothWays if true, the link is traversable both ways, if false, only from start to end
  59. */
  60. UFUNCTION(BlueprintCallable, Category = SmartLink)
  61. void SetSmartLinkData(FVector relStartPoint, FVector relEndPoint, bool bBothWays);
  62.  
  63. protected:
  64.  
  65.  
  66. public:
  67.  
  68. /**
  69. * @brief Toggles the relevancy of this smart link
  70. */
  71. UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = SmartLink)
  72. bool bSmartLinkIsRelevant;
  73.  
  74. protected:
  75.  
  76. };
  77.  
Advertisement
Add Comment
Please, Sign In to add comment