Clothing system refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "Components/BoxComponent.h"
|
||||
#include "Components/WidgetComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
@@ -71,7 +71,14 @@ void AItemPickup::SetItem(UClothingItemInstance* InItem)
|
||||
{
|
||||
ClothingItemInstance = InItem;
|
||||
|
||||
Mesh->SetStaticMesh(InItem->GetClothingItem()->StaticMesh);
|
||||
Mesh->SetStaticMesh(InItem->GetClothingItemDefinition()->StaticMesh);
|
||||
if (!InItem->GetClothingItemDefinition()->Materials.IsEmpty())
|
||||
{
|
||||
for (const TPair<FName, UMaterialInstance*>& Material : InItem->GetClothingItemDefinition()->Materials)
|
||||
{
|
||||
Mesh->SetMaterialByName(Material.Key, Material.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AItemPickup::ApplyOutline(UStaticMeshComponent* InMesh, bool bEnabled, int32 StencilValue)
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
virtual void ShowInteractionFocusHint_Implementation() override;
|
||||
virtual void ShowInteractionProximityHint_Implementation() override;
|
||||
|
||||
|
||||
void SetItem(UClothingItemInstance* InItem);
|
||||
UClothingItemInstance* GetItem() const { return ClothingItemInstance; }
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Wardrobe.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||
@@ -29,7 +30,10 @@ void AWardrobe::BeginPlay()
|
||||
|
||||
for (const FItemSaveRecord& ItemSaveRecord : SaveGame->GetWardrobeItems())
|
||||
{
|
||||
UClothingItemInstance* NewItemInstance = UClothingItemInstance::CreateFromSave(this, ItemSaveRecord);
|
||||
UClothingItemInstance* NewItemInstance = Cast<UClothingItemInstance>(UItemInstance::CreateFromRecord(this, ItemSaveRecord));
|
||||
if (!NewItemInstance)
|
||||
continue;
|
||||
|
||||
ClothingItems.Push(NewItemInstance);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user