Files
mikko mononen ef148ecd80 StateTree: StateTree UI spring clean.
- Added icons and icon colors for ST nodes
- Implemented icons for some common ST nodes
- Small update to ST logic icons
- Added icons to the task list in State treeview row, adjusted task list BG color to make icons visible
- Fixed ST editor tabs icons and names (e.g. there were two tabs that had the same label)
- Moved ST node picker to separate class
- Moved category array customization to common helper function
- Added node icons to the ST node picker
- Add node button is not node selector too (simila to Niagara)
- Consolidated the add button style across all lists
- Cleaned up the node customization
  - Moved type selector, debug, and property controls into one menu at right
  - The combined menu can be also summoned using right click
  - Renaming now has to be triggered via the menu
  - Replacing node happens via menu
  - Most of the row was left "clickable" to later use it for selection
  - Improved the visualization and controls for the expression indentation
- Cleaned up state customization
  - Moved parameters to own category (similar to the tree params)
  - Moved event to the enter conditions category
- Cleaned up transition customization
  - Improved the transition display
  - Consolidated add button styles

#jira UE-180608
#rb Juan.Portillo, Mieszko.Zielinski

[CL 33030431 by mikko mononen in ue5-main branch]
2024-04-17 03:01:36 -04:00

113 lines
4.5 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "AISystem.h"
#include "NavFilters/NavigationQueryFilter.h"
#include "Tasks/StateTreeAITask.h"
#include "Templates/SubclassOf.h"
#include "StateTreeMoveToTask.generated.h"
class AActor;
class AAIController;
class IGameplayTaskOwnerInterface;
class UAITask_MoveTo;
struct FAIMoveRequest;
USTRUCT()
struct FStateTreeMoveToTaskInstanceData
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = Context)
TObjectPtr<AAIController> AIController = nullptr;
UPROPERTY(EditAnywhere, Category = Parameter)
FVector Destination = FVector::Zero();
UPROPERTY(EditAnywhere, Category = Parameter)
TObjectPtr<AActor> TargetActor;
/** fixed distance added to threshold between AI and goal location in destination reach test */
UPROPERTY(EditAnywhere, Category = Parameter, meta=(ClampMin = "0.0", UIMin="0.0"))
float AcceptableRadius = GET_AI_CONFIG_VAR(AcceptanceRadius);
/** if the task is expected to react to changes to location in input
* this property can be used to tweak sensitivity of the mechanism. Value is
* recommended to be less than AcceptableRadius */
UPROPERTY(EditAnywhere, Category = Parameter, meta = (ClampMin = "0.0", UIMin = "0.0", EditCondition="bTrackMovingGoal"))
float DestinationMoveTolerance = 0.f;
/** "None" will result in default filter being used */
UPROPERTY(EditAnywhere, Category = Parameter)
TSubclassOf<UNavigationQueryFilter> FilterClass;
UPROPERTY(EditAnywhere, Category = Parameter)
bool bAllowStrafe = GET_AI_CONFIG_VAR(bAllowStrafing);
/** if set, use incomplete path when goal can't be reached */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bAllowPartialPath = GET_AI_CONFIG_VAR(bAcceptPartialPaths);
/** if set, path to goal actor will update itself when actor moves */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bTrackMovingGoal = true;
/** if set, the goal location will need to be navigable */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bRequireNavigableEndLocation = true;
/** if set, goal location will be projected on navigation data (navmesh) before using */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bProjectGoalLocation = true;
/** if set, radius of AI's capsule will be added to threshold between AI and goal location in destination reach test */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bReachTestIncludesAgentRadius = GET_AI_CONFIG_VAR(bFinishMoveOnGoalOverlap);
/** if set, radius of goal's capsule will be added to threshold between AI and goal location in destination reach test */
UPROPERTY(EditAnywhere, Category = Parameter)
bool bReachTestIncludesGoalRadius = GET_AI_CONFIG_VAR(bFinishMoveOnGoalOverlap);
UPROPERTY(Transient)
TObjectPtr<UAITask_MoveTo> MoveToTask = nullptr;
UPROPERTY(Transient)
TScriptInterface<IGameplayTaskOwnerInterface> TaskOwner = nullptr;
};
/**
* Task moving the given AIController's pawn using the AITask_MoveTo framework. Succeed when move ends at destinations, fails if move is impossible.
*/
USTRUCT(meta = (DisplayName = "Move To", Category = "AI|Action"))
struct FStateTreeMoveToTask : public FStateTreeAIActionTaskBase
{
GENERATED_BODY()
using FInstanceDataType = FStateTreeMoveToTaskInstanceData;
virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
GAMEPLAYSTATETREEMODULE_API virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
GAMEPLAYSTATETREEMODULE_API virtual EStateTreeRunStatus Tick(FStateTreeExecutionContext& Context, const float DeltaTime) const override;
GAMEPLAYSTATETREEMODULE_API virtual void ExitState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
GAMEPLAYSTATETREEMODULE_API virtual UAITask_MoveTo* PrepareMoveToTask(FStateTreeExecutionContext& Context, AAIController& Controller, UAITask_MoveTo* ExistingTask, FAIMoveRequest& MoveRequest) const;
GAMEPLAYSTATETREEMODULE_API virtual EStateTreeRunStatus PerformMoveTask(FStateTreeExecutionContext& Context, AAIController& Controller) const;
#if WITH_EDITOR
virtual FText GetDescription(const FGuid& ID, FStateTreeDataView InstanceDataView, const IStateTreeBindingLookup& BindingLookup, EStateTreeNodeFormatting Formatting = EStateTreeNodeFormatting::Text) const override;
virtual FName GetIconName() const override
{
return FName("StateTreeEditorStyle|Node.Movement");
}
virtual FColor GetIconColor() const override
{
return UE::StateTree::Colors::Grey;
}
#endif // WITH_EDITOR
};