Bazaar improvements, moved some stuff into cpp and start creating the settings asset
This commit is contained in:
BIN
Content/GameData/DA_BazaarSettings.uasset
LFS
Normal file
BIN
Content/GameData/DA_BazaarSettings.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,3 +3,12 @@
|
||||
|
||||
#include "BazarSellingStand.h"
|
||||
|
||||
void ABazarSellingStand::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
BazarSettingsDataAsset.LoadAsync(FLoadSoftObjectPathAsyncDelegate::CreateWeakLambda(this, [this](const FSoftObjectPath& Path, UObject* Object)
|
||||
{
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "ProjectEleri/GameObjects/EleriBaseActor.h"
|
||||
#include "BazarSellingStand.generated.h"
|
||||
|
||||
class UBazarSettingsDataAsset;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -14,4 +16,11 @@ class PROJECTELERI_API ABazarSellingStand : public AEleriBaseActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Eleri|Bazaar")
|
||||
TSoftObjectPtr<UBazarSettingsDataAsset> BazarSettingsDataAsset;
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
};
|
||||
|
||||
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