Clothing system refactor
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "NakedDesireGameMode.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemDefinition.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Interactables/ItemPickup.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
@@ -34,10 +34,10 @@ void ANakedDesireGameMode::BuyItem(UClothingItemInstance* ClothingItemInstance)
|
||||
return;
|
||||
}
|
||||
|
||||
if (SaveGame->Money < ClothingItemInstance->GetClothingItem()->BasePrice)
|
||||
if (SaveGame->Money < ClothingItemInstance->GetClothingItemDefinition()->BasePrice)
|
||||
return;
|
||||
|
||||
SaveGame->Money -= ClothingItemInstance->GetClothingItem()->BasePrice;
|
||||
SaveGame->Money -= ClothingItemInstance->GetClothingItemDefinition()->BasePrice;
|
||||
Wardrobe->AddItem(ClothingItemInstance);
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ void ANakedDesireGameMode::BeginPlay()
|
||||
}
|
||||
|
||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||
for (const auto& Item : SaveSubsystem->GetCurrentSave()->GetWorldItems())
|
||||
for (const FItemSaveRecord& Item : SaveSubsystem->GetCurrentSave()->GetWorldItems())
|
||||
{
|
||||
UClothingItemInstance* NewItemInstance = NewObject<UClothingItemInstance>(this);
|
||||
NewItemInstance->Init(Item.Definition.Get());
|
||||
NewItemInstance->Condition = Item.Condition;
|
||||
NewItemInstance->SetInstanceId(Item.InstanceId);
|
||||
UClothingItemInstance* NewItemInstance = Cast<UClothingItemInstance>(UItemInstance::CreateFromRecord(this, Item));
|
||||
if (!NewItemInstance)
|
||||
continue;
|
||||
|
||||
AItemPickup* NewItemPickup = GetWorld()->SpawnActor<AItemPickup>(ItemPickupClass, Item.WorldTransform);
|
||||
NewItemPickup->SetItem(NewItemInstance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user