#include "ClothingItemInstance.h"

#include "ClothingItemDefinition.h"
#include "StructUtils/InstancedStruct.h"

void UClothingItemInstance::Init(UClothingItemDefinition* InClothingItem)
{
	ItemDefinition = InClothingItem;
}

void UClothingItemInstance::CaptureState(FInstancedStruct& OutState) const
{
	FClothingInstanceState ClothingState;
	ClothingState.Condition = Condition;
	OutState.InitializeAs<FClothingInstanceState>(ClothingState);
}

void UClothingItemInstance::ApplyState(const FInstancedStruct& InState)
{
	if (const FClothingInstanceState* ClothingState = InState.GetPtr<FClothingInstanceState>())
	{
		Condition = ClothingState->Condition;
	}
}