Files
UnrealEngineUWP/Engine/Plugins/Runtime/GameplayInteractions/Source/GameplayInteractionsModule/Private/StateTree/GameplayInteractionFindSlotTask.h
mikko mononen 8dc086e33a Gameplay Interactions:
- Moved all State Tree things into StateTree folder
- Added StateTree conditions that check Smart Object slot tags and state
- Added StateTree task to modify SmartObject slot tags
- Added StateTree task to monitor SmartObject slot tags
- Added StateTree task to listen SmartObject events
- Added StateTree task to sync execution based on SmartObject slot tags

#rb Maxime.Mercier Luciano.Ferraro
#preflight 636124a8ef6d25c67458635c

[CL 22888785 by mikko mononen in ue5-main branch]
2022-11-01 15:14:34 -04:00

70 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameplayInteractionsTypes.h"
#include "SmartObjectTypes.h"
#include "GameplayInteractionFindSlotTask.generated.h"
class USmartObjectSubsystem;
/**
* Task to find a Smart Object slot based on a reference slot.
* The search can look up slots in the whole Smart Object based on Activity tags,
* or use Smart Object Slot Link annotations on the reference slot.
*/
UENUM()
enum class EGameplayInteractionSlotReferenceType : uint8
{
/** Consider all slots on the Reference Slot's Smart Object. Match by activity tag. */
ByActivityTag,
/** Consider slots linked via Link Annotations on Reference Slot. Match by link's tag. */
ByLinkTag,
};
USTRUCT()
struct FGameplayInteractionFindSlotTaskInstanceData
{
GENERATED_BODY()
/** Slot to use as reference to find the result slot. */
UPROPERTY(EditAnywhere, Category="Input")
FSmartObjectSlotHandle ReferenceSlot;
/** Result slot. */
UPROPERTY(EditAnywhere, Category="Output")
FSmartObjectSlotHandle ResultSlot;
};
USTRUCT(meta = (DisplayName = "(Gameplay Interaction) Find Slot"))
struct FGameplayInteractionFindSlotTask : public FGameplayInteractionStateTreeTask
{
GENERATED_BODY()
FGameplayInteractionFindSlotTask();
using FInstanceDataType = FGameplayInteractionFindSlotTaskInstanceData;
protected:
virtual const UStruct* GetInstanceDataType() const override { return FInstanceDataType::StaticStruct(); }
virtual bool Link(FStateTreeLinker& Linker) override;
virtual EStateTreeRunStatus EnterState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
bool UpdateResult(const FStateTreeExecutionContext& Context) const;
/** Specified which slots to consider when finding the slot. */
UPROPERTY(EditAnywhere, Category="Parameter")
EGameplayInteractionSlotReferenceType ReferenceType = EGameplayInteractionSlotReferenceType::ByLinkTag;
/** Tag to use to lookup the slot. */
UPROPERTY(EditAnywhere, Category="Parameter")
FGameplayTag FindByTag;
/** Handle to retrieve USmartObjectSubsystem. */
TStateTreeExternalDataHandle<USmartObjectSubsystem> SmartObjectSubsystemHandle;
};