|
@@ -0,0 +1,127 @@
|
|
|
+// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
+
|
|
|
+#pragma once
|
|
|
+
|
|
|
+#include "CoreMinimal.h"
|
|
|
+#include "UObject/Object.h"
|
|
|
+#include "EzAbilityTypes.generated.h"
|
|
|
+
|
|
|
+UENUM(BlueprintType)
|
|
|
+enum class ESliceRunStatus : uint8
|
|
|
+{
|
|
|
+ Running,
|
|
|
+ Failed,
|
|
|
+ Succeeded,
|
|
|
+ Stopped,
|
|
|
+ Unset,
|
|
|
+};
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+///Slice
|
|
|
+UENUM()
|
|
|
+enum class ESliceType
|
|
|
+{
|
|
|
+ Main,
|
|
|
+ Parallel,
|
|
|
+};
|
|
|
+
|
|
|
+USTRUCT(BlueprintType)
|
|
|
+struct EZABILITY_API FEzAbilitySliceHandle
|
|
|
+{
|
|
|
+ GENERATED_BODY()
|
|
|
+
|
|
|
+ static constexpr uint16 InvalidIndex = uint16(-1); // Index value indicating invalid state.
|
|
|
+ static constexpr uint16 SucceededIndex = uint16(-2); // Index value indicating a Succeeded state.
|
|
|
+ static constexpr uint16 FailedIndex = uint16(-3); // Index value indicating a Failed state.
|
|
|
+ static constexpr uint16 StoppedIndex = uint16(-4); // Index value indicating a Stopped state.
|
|
|
+
|
|
|
+ static const FEzAbilitySliceHandle Invalid;
|
|
|
+ static const FEzAbilitySliceHandle Succeeded;
|
|
|
+ static const FEzAbilitySliceHandle Failed;
|
|
|
+ static const FEzAbilitySliceHandle Stopped;
|
|
|
+ static const FEzAbilitySliceHandle Root;
|
|
|
+
|
|
|
+ static bool IsValidIndex(const int32 Index) { return Index >= 0 && Index < (int32)MAX_uint16; }
|
|
|
+ friend FORCEINLINE uint32 GetTypeHash(const FEzAbilitySliceHandle& Handle) { return GetTypeHash(Handle.Index); }
|
|
|
+
|
|
|
+ FEzAbilitySliceHandle() = default;
|
|
|
+ explicit FEzAbilitySliceHandle(const uint16 InIndex) : Index(InIndex) {}
|
|
|
+ explicit FEzAbilitySliceHandle(const int32 InIndex) : Index()
|
|
|
+ {
|
|
|
+ check(InIndex == INDEX_NONE || IsValidIndex(InIndex));
|
|
|
+ Index = InIndex == INDEX_NONE ? InvalidIndex : static_cast<uint16>(InIndex);
|
|
|
+ }
|
|
|
+
|
|
|
+ bool IsValid() const { return Index != InvalidIndex; }
|
|
|
+ void Invalidate() { Index = InvalidIndex; }
|
|
|
+ bool IsCompletionState() const { return Index == SucceededIndex || Index == FailedIndex || Index == StoppedIndex; }
|
|
|
+
|
|
|
+ bool operator==(const FEzAbilitySliceHandle& RHS) const { return Index == RHS.Index; }
|
|
|
+ bool operator!=(const FEzAbilitySliceHandle& RHS) const { return Index != RHS.Index; }
|
|
|
+
|
|
|
+ FString Describe() const
|
|
|
+ {
|
|
|
+ switch (Index)
|
|
|
+ {
|
|
|
+ case InvalidIndex: return TEXT("Invalid");
|
|
|
+ case SucceededIndex: return TEXT("Succeeded");
|
|
|
+ case FailedIndex: return TEXT("Failed");
|
|
|
+ case StoppedIndex: return TEXT("Stopped");
|
|
|
+ default: return FString::Printf(TEXT("%d"), Index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ESliceRunStatus ToCompletionStatus() const;
|
|
|
+ static FEzAbilitySliceHandle FromCompletionStatus(const ESliceRunStatus Status);
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ uint16 Index = InvalidIndex;
|
|
|
+};
|
|
|
+
|
|
|
+USTRUCT()
|
|
|
+struct EZABILITY_API FCompactEzAbilitySlice
|
|
|
+{
|
|
|
+ GENERATED_BODY()
|
|
|
+
|
|
|
+ FCompactEzAbilitySlice();
|
|
|
+
|
|
|
+ uint16 GetNextIndex() const { return ChildrenEnd; };
|
|
|
+ bool HasChildren() const { return ChildrenEnd > ChildrenBegin; };
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ uint8 bEnabled : 1;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ ESliceType Type = ESliceType::Main;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ FName Name;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ FEzAbilitySliceHandle Parent = FEzAbilitySliceHandle::Invalid;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ float StartTime;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ float EndTime;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ uint16 ChildrenBegin = 0;
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ uint16 ChildrenEnd = 0;
|
|
|
+};
|
|
|
+
|
|
|
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+///Transition
|
|
|
+USTRUCT()
|
|
|
+struct EZABILITY_API FCompactEzAbilityTransition
|
|
|
+{
|
|
|
+ GENERATED_BODY()
|
|
|
+
|
|
|
+ FCompactEzAbilityTransition();
|
|
|
+
|
|
|
+ UPROPERTY()
|
|
|
+ FEzAbilitySliceHandle State = FEzAbilitySliceHandle::Invalid;
|
|
|
+};
|