Clothing system refactor
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Items/ItemInstance.h"
|
||||
#include "ClothingItemInstance.generated.h"
|
||||
|
||||
struct FItemSaveRecord;
|
||||
class UClothingItem;
|
||||
class UClothingItemDefinition;
|
||||
|
||||
/** Per-instance mutable state for clothing. */
|
||||
USTRUCT()
|
||||
struct FClothingInstanceState : public FItemInstanceState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(SaveGame)
|
||||
float Condition = 1.0f;
|
||||
};
|
||||
|
||||
UCLASS(BlueprintType)
|
||||
class NAKEDDESIRE_API UClothingItemInstance : public UItemInstance
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing Item")
|
||||
float Condition = 1.0f;
|
||||
|
||||
UClothingItem* GetClothingItem() const { return ClothingItem; }
|
||||
|
||||
void Init(UClothingItem* InClothingItem);
|
||||
void Setup(UClothingItem* InClothingItem, const TArray<UItemInstance*>& InStoredItems, float InCondition, FGuid InInstanceId);
|
||||
|
||||
static UClothingItemInstance* CreateFromSave(UObject* Outer, const FItemSaveRecord& ItemSaveRecord);
|
||||
|
||||
|
||||
UClothingItemDefinition* GetClothingItemDefinition() const { return Cast<UClothingItemDefinition>(ItemDefinition); }
|
||||
|
||||
void Init(UClothingItemDefinition* InClothingItem);
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing Item")
|
||||
TObjectPtr<UClothingItem> ClothingItem;
|
||||
|
||||
virtual void CaptureState(FInstancedStruct& OutState) const override;
|
||||
virtual void ApplyState(const FInstancedStruct& InState) override;
|
||||
|
||||
UPROPERTY(BlueprintReadOnly, Category = "Clothing Item")
|
||||
TArray<TObjectPtr<UItemInstance>> StoredItems;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user