2021-09-28 13:33:00 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-03 09:13:49 -05:00
|
|
|
#include "StateTreeNodeBase.h"
|
2023-06-27 09:09:35 -04:00
|
|
|
#include "StateTreeExecutionTypes.h"
|
2021-09-28 13:33:00 -04:00
|
|
|
#include "StateTreeConditionBase.generated.h"
|
|
|
|
|
|
2023-01-25 02:42:36 -05:00
|
|
|
struct FStateTreeExecutionContext;
|
2021-09-28 13:33:00 -04:00
|
|
|
|
2022-08-23 13:04:52 -04:00
|
|
|
enum class EStateTreeCompare : uint8
|
|
|
|
|
{
|
|
|
|
|
Default,
|
|
|
|
|
Invert,
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-28 13:33:00 -04:00
|
|
|
/**
|
|
|
|
|
* Base struct for all conditions.
|
|
|
|
|
*/
|
2022-05-18 02:35:34 -04:00
|
|
|
USTRUCT(meta = (Hidden))
|
2022-02-03 09:13:49 -05:00
|
|
|
struct STATETREEMODULE_API FStateTreeConditionBase : public FStateTreeNodeBase
|
2021-09-28 13:33:00 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
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; }
|
2022-03-28 04:48:50 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
EStateTreeConditionOperand Operand = EStateTreeConditionOperand::And;
|
|
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
int8 DeltaIndent = 0;
|
2023-06-05 13:12:19 -04:00
|
|
|
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
EStateTreeConditionEvaluationMode EvaluationMode = EStateTreeConditionEvaluationMode::Evaluated;
|
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()
|
|
|
|
|
};
|
|
|
|
|
|
2022-05-11 04:04:58 -04:00
|
|
|
/** Helper macro to define instance data as simple constructible. */
|
|
|
|
|
#define STATETREE_POD_INSTANCEDATA(Type) \
|
|
|
|
|
template <> struct TIsPODType<Type> { enum { Value = true }; }; \
|
|
|
|
|
template<> \
|
|
|
|
|
struct TStructOpsTypeTraits<Type> : public TStructOpsTypeTraitsBase2<Type> \
|
|
|
|
|
{ \
|
|
|
|
|
enum \
|
|
|
|
|
{ \
|
|
|
|
|
WithZeroConstructor = true, \
|
|
|
|
|
WithNoDestructor = true, \
|
|
|
|
|
}; \
|
|
|
|
|
};
|
2023-01-25 02:42:36 -05:00
|
|
|
|
|
|
|
|
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
|
|
|
|
|
#include "StateTreeExecutionContext.h"
|
|
|
|
|
#include "StateTreePropertyBindings.h"
|
|
|
|
|
#endif
|