Files
UnrealEngineUWP/Engine/Plugins/Runtime/GameplayInteractions/Source/GameplayInteractionsModule/Private/StateTree/GameplayInteractionSetSlotEnabledTask.h
mikko mononen 1bc7452c79 Gameplay Interaction: Set Slot Enabled task
- added task to enable and disabled slots
- visualize disabled slots in Smart Object editor

#rb Luciano.Ferraro
#preflight 6364e3364b0e01486a464fa5

[CL 22985540 by mikko mononen in ue5-main branch]
2022-11-04 09:18:52 -04:00

59 lines
2.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "GameplayInteractionsTypes.h"
#include "SmartObjectTypes.h"
#include "GameplayInteractionSetSlotEnabledTask.generated.h"
class USmartObjectSubsystem;
/**
* Task to set a Smart Object Slot enabled to disabled.
* The slot can be enabled or disable for the duration of the task (OnEnterStateUndoOnExitState),
* or permanently at the beginning or end of the state.
*/
USTRUCT()
struct FGameplayInteractionSetSlotEnabledInstanceData
{
GENERATED_BODY()
/** Target slot whose tags are modified. */
UPROPERTY(EditAnywhere, Category = "Input")
FSmartObjectSlotHandle TargetSlot;
/** When using OnEnterStateUndoOnExitState, indicates initial enabled state to be restored on ExitState(). */
UPROPERTY()
bool bInitialState = false;
};
USTRUCT(meta = (DisplayName = "(Gameplay Interaction) Set Slot Enabled"))
struct FGameplayInteractionSetSlotEnabledTask : public FGameplayInteractionStateTreeTask
{
GENERATED_BODY()
FGameplayInteractionSetSlotEnabledTask();
using FInstanceDataType = FGameplayInteractionSetSlotEnabledInstanceData;
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;
virtual void ExitState(FStateTreeExecutionContext& Context, const FStateTreeTransitionResult& Transition) const override;
/** When to modify the tags. */
UPROPERTY(EditAnywhere, Category = "Parameter")
EGameplayInteractionTaskModify Modify = EGameplayInteractionTaskModify::OnEnterStateUndoOnExitState;
/** Whether to enable or disable the slot. */
UPROPERTY(EditAnywhere, Category = "Parameter")
bool bEnableSlot = true;
/** Handle to retrieve USmartObjectSubsystem. */
TStateTreeExternalDataHandle<USmartObjectSubsystem> SmartObjectSubsystemHandle;
};