Updated Inventory Component for Resising Functionality

This commit is contained in:
Philip W 2023-10-26 11:59:50 +01:00
parent 2553f471e5
commit c794a905da
4 changed files with 14 additions and 5 deletions

Binary file not shown.

View File

@ -181,6 +181,13 @@ void UInventoryComponent::SpawnItem(UBaseItem* Item, FVector Location)
{
}
void UInventoryComponent::UpdateInventorySize_Implementation(const int _Columns, const int _Rows)
{
Columns = _Columns;
Rows = _Rows;
InventoryItems.SetNum(Columns * Rows);
}
bool UInventoryComponent::IsTileValid(const FInventoryTile InventoryTile) const
{
if (InventoryTile.X >= 0 && InventoryTile.Y >= 0 && InventoryTile.X < Columns && InventoryTile.Y < Columns && InventoryTile.Y <= Rows)

View File

@ -49,7 +49,6 @@ public:
bool IsRoomAvailable(class UBaseItem* Item, const int TopLeftIndex);
UFUNCTION(BlueprintCallable, Category="Inventory")
FInventoryTile IndexToTile(const int Index) const;
//UFUNCTION(BlueprintCallable, Category="Inventory")
TTuple<UBaseItem*, bool> GetItemAtIndex(const int Index);
UFUNCTION(BlueprintCallable, Category="Inventory")
int TileToIndex(const FInventoryTile InventoryTile) const;
@ -61,6 +60,9 @@ public:
void RemoveItem(class UBaseItem* Item);
UFUNCTION(BlueprintCallable, Category="Inventory")
void SpawnItem(class UBaseItem* Item, FVector Location);
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Exec, Category = "Inventory")
void UpdateInventorySize(const int _Columns, const int _Rows);
virtual void UpdateInventorySize_Implementation(const int _Columns, const int _Rows);
private:
bool IsTileValid(const FInventoryTile InventoryTile) const;