File size: 1,921 Bytes
8d44bc8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | // Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "StateTreeTaskBase.h"
#include "SideScrollingStateTreeUtility.generated.h"
class AAIController;
/**
* Instance data for the FStateTreeGetPlayerTask task
*/
USTRUCT()
struct FStateTreeGetPlayerInstanceData
{
GENERATED_BODY()
/** NPC owning this task */
UPROPERTY(VisibleAnywhere, Category="Context")
TObjectPtr<APawn> NPC;
/** Holds the found player pawn */
UPROPERTY(VisibleAnywhere, Category="Context")
TObjectPtr<AAIController> Controller;
/** Holds the found player pawn */
UPROPERTY(VisibleAnywhere, Category="Output")
TObjectPtr<APawn> TargetPlayer;
/** Is the pawn close enough to be considered a valid target? */
UPROPERTY(VisibleAnywhere, Category="Output")
bool bValidTarget = false;
/** Max distance to be considered a valid target */
UPROPERTY(EditAnywhere, Category="Parameter", meta = (ClampMin = 0, ClampMax = 10000, Units = "cm"))
float RangeMax = 1000.0f;
};
/**
* StateTree task to get the player-controlled character
*/
USTRUCT(meta=(DisplayName="Get Player", Category="Side Scrolling"))
struct FStateTreeGetPlayerTask : public FStateTreeTaskCommonBase
{
GENERATED_BODY()
/* Ensure we're using the correct instance data struct */
using FInstanceDataType = FStateTreeGetPlayerInstanceData;
virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
/** Runs while the owning state is active */
virtual EStateTreeRunStatus Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const override;
#if WITH_EDITOR
virtual FText GetDescription(const FGuid& ID, FStateTreeDataView InstanceDataView, const IStateTreeBindingLookup& BindingLookup, EStateTreeNodeFormatting Formatting = EStateTreeNodeFormatting::Text) const override;
#endif // WITH_EDITOR
}; |