Updated Inventory Component for Dropping of Items

This commit is contained in:
Philip W 2023-11-27 00:43:10 +00:00
parent e4ff0735df
commit 3ac6ea3a27
5 changed files with 13 additions and 9 deletions

Binary file not shown.

View File

@ -8,7 +8,8 @@
#include "InputActionValue.h"
#include "Components/ArrowComponent.h"
#include "GadgetSystem/GadgetManager.h"
#include "Inventory/InventoryComponent.h"
#include "EndlessVendettaCharacter.generated.h"
class UWeaponInventory;

View File

@ -178,6 +178,9 @@ void UInventoryComponent::RemoveItem(UBaseItem* Item)
void UInventoryComponent::SpawnItem(UBaseItem* Item, FVector Location)
{
if (!IsValid(Item)) return;
if (!IsValid(Item->ItemActor)) return;
GetWorld()->SpawnActor(Item->ItemActor, &Location);
}
void UInventoryComponent::UpdateInventorySize(const int _Columns, const int _Rows)

View File

@ -48,20 +48,20 @@ public:
UFUNCTION(BlueprintCallable, Category="Inventory")
void Pickup();
UFUNCTION(BlueprintCallable, Category="Inventory")
bool IsRoomAvailable(class UBaseItem* Item, const int TopLeftIndex);
bool IsRoomAvailable(UBaseItem* Item, const int TopLeftIndex);
UFUNCTION(BlueprintCallable, Category="Inventory")
FInventoryTile IndexToTile(const int Index) const;
TTuple<UBaseItem*, bool> GetItemAtIndex(const int Index);
UFUNCTION(BlueprintCallable, Category="Inventory")
int TileToIndex(const FInventoryTile InventoryTile) const;
UFUNCTION(BlueprintCallable, Category="Inventory")
void AddItemAt(class UBaseItem* Item, const int TopLeftIndex);
void AddItemAt(UBaseItem* Item, const int TopLeftIndex);
UFUNCTION(BlueprintCallable, Category="Inventory")
TMap<UBaseItem*, FInventoryTile> GetAllItems();
UFUNCTION(BlueprintCallable, Category="Inventory")
void RemoveItem(class UBaseItem* Item);
void RemoveItem(UBaseItem* Item);
UFUNCTION(BlueprintCallable, Category="Inventory")
void SpawnItem(class UBaseItem* Item, FVector Location);
void SpawnItem(UBaseItem* Item, FVector Location);
UFUNCTION(BlueprintCallable, Category = "Inventory")
void UpdateInventorySize(const int _Columns, const int _Rows);