Clothing system refactor
This commit is contained in:
@@ -1,27 +1,24 @@
|
||||
#include "ClothingItemInstance.h"
|
||||
|
||||
#include "ClothingItem.h"
|
||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
||||
#include "ClothingItemDefinition.h"
|
||||
#include "StructUtils/InstancedStruct.h"
|
||||
|
||||
void UClothingItemInstance::Init(UClothingItem* InClothingItem)
|
||||
void UClothingItemInstance::Init(UClothingItemDefinition* InClothingItem)
|
||||
{
|
||||
ClothingItem = InClothingItem;
|
||||
ItemDefinition = InClothingItem;
|
||||
}
|
||||
|
||||
void UClothingItemInstance::Setup(UClothingItem* InClothingItem, const TArray<UItemInstance*>& InStoredItems,
|
||||
const float InCondition, const FGuid InInstanceId)
|
||||
void UClothingItemInstance::CaptureState(FInstancedStruct& OutState) const
|
||||
{
|
||||
this->ClothingItem = InClothingItem;
|
||||
this->StoredItems = InStoredItems;
|
||||
this->Condition = InCondition;
|
||||
this->InstanceId = InInstanceId;
|
||||
FClothingInstanceState ClothingState;
|
||||
ClothingState.Condition = Condition;
|
||||
OutState.InitializeAs<FClothingInstanceState>(ClothingState);
|
||||
}
|
||||
|
||||
UClothingItemInstance* UClothingItemInstance::CreateFromSave(UObject* Outer, const FItemSaveRecord& ItemSaveRecord)
|
||||
void UClothingItemInstance::ApplyState(const FInstancedStruct& InState)
|
||||
{
|
||||
UClothingItemInstance* NewItemInstance = NewObject<UClothingItemInstance>(Outer);
|
||||
|
||||
NewItemInstance->Setup(ItemSaveRecord.Definition.Get(), {}, ItemSaveRecord.Condition, ItemSaveRecord.InstanceId);
|
||||
|
||||
return NewItemInstance;
|
||||
}
|
||||
if (const FClothingInstanceState* ClothingState = InState.GetPtr<FClothingInstanceState>())
|
||||
{
|
||||
Condition = ClothingState->Condition;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user