Bazaar improvements, moved some stuff into cpp and start creating the settings asset
This commit is contained in:
25
Source/ProjectEleri/Data/BazarSettingsDataAsset.cpp
Normal file
25
Source/ProjectEleri/Data/BazarSettingsDataAsset.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BazarSettingsDataAsset.h"
|
||||
|
||||
void UBazarSettingsDataAsset::GetModifiersFromEmotionData(const FBazarDialogueEmotionData& InData, int32& OutAnger,
|
||||
int32& OutFear, int32& OutSadness)
|
||||
{
|
||||
for (const FBazarEmotionModifier& Mod : InData.EmotionModifiers)
|
||||
{
|
||||
switch (Mod.Emotion)
|
||||
{
|
||||
case EBazarNpcEmotion::Anger:
|
||||
OutAnger = FMath::RandRange(Mod.ValueMin, Mod.ValueMax);
|
||||
break;
|
||||
case EBazarNpcEmotion::Fear:
|
||||
OutFear = FMath::RandRange(Mod.ValueMin, Mod.ValueMax);
|
||||
break;
|
||||
case EBazarNpcEmotion::Sadness:
|
||||
OutSadness = FMath::RandRange(Mod.ValueMin, Mod.ValueMax);
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Source/ProjectEleri/Data/BazarSettingsDataAsset.h
Normal file
61
Source/ProjectEleri/Data/BazarSettingsDataAsset.h
Normal file
@@ -0,0 +1,61 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "BazarSettingsDataAsset.generated.h"
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EBazarNpcEmotion: uint8
|
||||
{
|
||||
None,
|
||||
Anger,
|
||||
Fear,
|
||||
Sadness,
|
||||
MAX UMETA(Hidden)
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBazarEmotionModifier
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
EBazarNpcEmotion Emotion;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
float ValueMin = 0.f;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
float ValueMax = 0.f;
|
||||
|
||||
float GetValueInRange() const { return FMath::RandRange(ValueMin, ValueMax); }
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBazarDialogueEmotionData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
TArray<FBazarEmotionModifier> EmotionModifiers;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
FText DialogueText;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class PROJECTELERI_API UBazarSettingsDataAsset : public UDataAsset
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere)
|
||||
TArray<FBazarDialogueEmotionData> AvailableDialogueEmotionData;
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Eleri|Bazaar")
|
||||
static void GetModifiersFromEmotionData(const FBazarDialogueEmotionData& InData, int32& OutAnger, int32& OutFear, int32& OutSadness);
|
||||
};
|
||||
Reference in New Issue
Block a user