Setting the stage for bazaar upgrade system
This commit is contained in:
@@ -9,3 +9,33 @@ void UBazarSettingsDataAsset::PostLoad()
|
||||
Super::PostLoad();
|
||||
|
||||
}
|
||||
|
||||
int32 UBazarSettingsDataAsset::GetCostOfUpgrade(const FGameplayTag& Tag, const int32 Level)
|
||||
{
|
||||
if (!Tag.IsValid() || Level > 10 || Level < 0) return 0;
|
||||
|
||||
for (auto Upgrade : UpgradeArray)
|
||||
{
|
||||
if (Tag == Upgrade.UpgradeTag)
|
||||
{
|
||||
return Upgrade.UpgradeCostCurve.GetRichCurveConst()->Eval(Level);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float UBazarSettingsDataAsset::GetUpgradeBenefitAmount(const FGameplayTag& Tag, const int32 Level)
|
||||
{
|
||||
if (!Tag.IsValid() || Level > 10 || Level < 0) return 0.f;
|
||||
|
||||
for (auto Upgrade : UpgradeArray)
|
||||
{
|
||||
if (Tag == Upgrade.UpgradeTag)
|
||||
{
|
||||
return Upgrade.UpgradeBenefitCurve.GetRichCurveConst()->Eval(Level);
|
||||
}
|
||||
}
|
||||
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "Engine/DataAsset.h"
|
||||
#include "BazarSettingsDataAsset.generated.h"
|
||||
|
||||
@@ -68,6 +69,26 @@ struct FBazaarHaggleCardData
|
||||
int32 CardDifficulty;
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FBazaarUpgradeData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (GameplayTagFilter = "Upgrade.Bazaar"))
|
||||
FGameplayTag UpgradeTag;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText UpgradeName;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FText UpgradeDescription;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UTexture2D> UpgradeIcon;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FRuntimeFloatCurve UpgradeCostCurve;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
FRuntimeFloatCurve UpgradeBenefitCurve;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -77,18 +98,28 @@ class PROJECTELERI_API UBazarSettingsDataAsset : public UDataAsset
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Eleri|Bazaar|Tresholds")
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tresholds")
|
||||
int32 HappyThreshold = 50;
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Eleri|Bazaar|Tresholds")
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tresholds")
|
||||
int32 EmotionLowerThreshold = 65;
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Eleri|Bazaar|Tresholds")
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tresholds")
|
||||
int32 EmotionUpperThreshold = 80;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Eleri|Bazaar")
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "General")
|
||||
TArray<FBazarDialogueEmotionData> AvailableDialogueEmotionData;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Eleri|Bazaar")
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "General")
|
||||
TArray<FBazaarHaggleCardData> HaggleCards;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Upgrades")
|
||||
TArray<FBazaarUpgradeData> UpgradeArray;
|
||||
|
||||
|
||||
virtual void PostLoad() override;
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Bazaar")
|
||||
int32 GetCostOfUpgrade(const FGameplayTag& Tag, const int32 Level);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Bazaar")
|
||||
float GetUpgradeBenefitAmount(const FGameplayTag& Tag, const int32 Level);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user