Skip to content

Instantly share code, notes, and snippets.

@louisgv
Created February 13, 2019 13:11
Show Gist options
  • Save louisgv/e1045b2e145b2f0d11328ca5e953653f to your computer and use it in GitHub Desktop.
Save louisgv/e1045b2e145b2f0d11328ca5e953653f to your computer and use it in GitHub Desktop.
SAD
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "Engine/DataTable.h"
#include "SharedStruct.generated.h"
template<class FEnumKey, class BEnumKey, class V3EnumKey, class V2EnumKey>
struct FBaseConstraintData;
struct FNewMovementConstraintData;
/**
*
*/
USTRUCT(BlueprintType)
struct FMovementConstraintData : public FTableRowBase
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FName, float> FloatConstraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FName, bool> BoolConstraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FName, FVector> Vector3Constraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FName, FVector2D> Vector2DConstraints;
};
template<class FEnumKey, class BEnumKey, class V3EnumKey, class V2EnumKey>
struct FBaseConstraintData
{
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<FEnumKey, float> FloatConstraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<BEnumKey, bool> BoolConstraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<V3EnumKey, FVector> Vector3Constraints;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TMap<V2EnumKey, FVector2D> Vector2DConstraints;
};
UENUM(BlueprintType) //"BlueprintType" is essential specifier
enum class EMovementKey1 : uint8
{
Default UMETA(DisplayName = "Default"),
Key1 UMETA(DisplayName = "Key1"),
Key2 UMETA(DisplayName = "Key2"),
};
UENUM(BlueprintType)
enum class EMovementKey2 : uint8
{
Default UMETA(DisplayName = "Default"),
Key1 UMETA(DisplayName = "Key1"),
Key2 UMETA(DisplayName = "Key2"),
};
UENUM(BlueprintType)
enum class EMovementKey3 : uint8
{
Default UMETA(DisplayName = "Default"),
Key1 UMETA(DisplayName = "Key1"),
};
UENUM(BlueprintType)
enum class EMovementKey4 : uint8
{
Default UMETA(DisplayName = "Default"),
Key2 UMETA(DisplayName = "Key2"),
};
struct FNewMovementConstraintData : public FBaseConstraintData<EMovementKey1, EMovementKey1, EMovementKey1, EMovementKey1> {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment