2021-09-28 13:33:00 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "StateTreeTypes.h"
|
2022-02-03 09:13:49 -05:00
|
|
|
#include "StateTreeNodeBase.h"
|
2021-12-01 03:41:24 -05:00
|
|
|
#include "StateTreeExecutionContext.h"
|
2021-11-30 03:53:20 -05:00
|
|
|
#if WITH_EDITOR
|
2021-12-01 03:41:24 -05:00
|
|
|
#include "StateTreePropertyBindings.h"
|
2021-11-30 03:53:20 -05:00
|
|
|
#endif
|
2021-09-28 13:33:00 -04:00
|
|
|
#include "StateTreeConditionBase.generated.h"
|
|
|
|
|
|
2021-11-30 03:53:20 -05:00
|
|
|
#if WITH_EDITOR
|
2021-09-28 13:33:00 -04:00
|
|
|
struct IStateTreeBindingLookup;
|
|
|
|
|
struct FStateTreeEditorPropertyPath;
|
2021-11-30 03:53:20 -05:00
|
|
|
#endif
|
2021-09-28 13:33:00 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Base struct for all conditions.
|
|
|
|
|
*/
|
|
|
|
|
USTRUCT()
|
2022-02-03 09:13:49 -05:00
|
|
|
struct STATETREEMODULE_API FStateTreeConditionBase : public FStateTreeNodeBase
|
2021-09-28 13:33:00 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
/** @return Rich text description of the condition. */
|
2021-12-01 03:41:24 -05:00
|
|
|
virtual FText GetDescription(const FGuid& ID, FStateTreeDataView InstanceData, const IStateTreeBindingLookup& BindingLookup) const { return FText::GetEmpty(); }
|
2021-09-28 13:33:00 -04:00
|
|
|
/**
|
|
|
|
|
* Called when binding of any of the properties in the condition changes.
|
2021-12-01 03:41:24 -05:00
|
|
|
* @param ID ID of the item, can be used make property paths to this item.
|
|
|
|
|
* @param InstanceData view to the instance data, can be struct or class.
|
2021-09-28 13:33:00 -04:00
|
|
|
* @param SourcePath Source path of the new binding.
|
|
|
|
|
* @param TargetPath Target path of the new binding (the property in the condition).
|
|
|
|
|
* @param BindingLookup Reference to binding lookup which can be used to reason about property paths.
|
|
|
|
|
*/
|
2021-12-01 03:41:24 -05:00
|
|
|
virtual void OnBindingChanged(const FGuid& ID, FStateTreeDataView InstanceData, const FStateTreeEditorPropertyPath& SourcePath, const FStateTreeEditorPropertyPath& TargetPath, const IStateTreeBindingLookup& BindingLookup) {}
|
2021-09-28 13:33:00 -04:00
|
|
|
#endif
|
2022-02-03 09:13:49 -05:00
|
|
|
|
2021-09-28 13:33:00 -04:00
|
|
|
/** @return True if the condition passes. */
|
2021-11-12 05:49:31 -05:00
|
|
|
virtual bool TestCondition(FStateTreeExecutionContext& Context) const { return false; }
|
2021-09-28 13:33:00 -04:00
|
|
|
};
|
2021-12-09 05:38:26 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Base class (namespace) for all common Conditions that are generally applicable.
|
|
|
|
|
* This allows schemas to safely include all conditions child of this struct.
|
|
|
|
|
*/
|
|
|
|
|
USTRUCT(meta = (Hidden))
|
|
|
|
|
struct STATETREEMODULE_API FStateTreeConditionCommonBase : public FStateTreeConditionBase
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
};
|
|
|
|
|
|