Rework interaction system
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "ClothingItemInstance.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Interactables/ItemPickup.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
||||
@@ -108,6 +109,24 @@ USkeletalMeshComponent* UClothingManager::GetMeshComponent(const EClothingSlotTy
|
||||
}
|
||||
}
|
||||
|
||||
void UClothingManager::SpawnClothingPickup(UClothingItemInstance* ItemInstance)
|
||||
{
|
||||
if (!ItemPickupActor)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::SpawnClothingPickup ItemPickupActor is not set"));
|
||||
return;
|
||||
}
|
||||
|
||||
AItemPickup* NewItemPickup = GetWorld()->SpawnActor<AItemPickup>(ItemPickupActor, GetOwner()->GetActorTransform());
|
||||
if (!NewItemPickup)
|
||||
{
|
||||
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::SpawnClothingPickup NewItemPickup == nullptr"));
|
||||
return;
|
||||
}
|
||||
|
||||
NewItemPickup->SetItem(ItemInstance);
|
||||
}
|
||||
|
||||
void UClothingManager::PutOnClothing(UClothingItemInstance* ClothingItemInstance)
|
||||
{
|
||||
if (!ClothingItemInstance)
|
||||
@@ -220,6 +239,8 @@ void UClothingManager::DropClothing(const EClothingSlotType ClothingType)
|
||||
FItemSaveRecord ItemSaveRecord;
|
||||
ItemSaveRecord.Init(ClothingItemInstance);
|
||||
SaveSubsystem->GetCurrentSave()->DroppedItems.Push(ItemSaveRecord);
|
||||
|
||||
SpawnClothingPickup(ClothingItemInstance);
|
||||
|
||||
OnClothingDropped.Broadcast(ClothingItemInstance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user