Bugfix Able to Place Items Outside of Grid
This commit is contained in:
parent
58931ab222
commit
50791b67c3
3
EndlessVendetta/Content/Inventory/M_Base_Rev.uasset
Normal file
3
EndlessVendetta/Content/Inventory/M_Base_Rev.uasset
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ddc0bd83ded6fbd643a6e2f17d8733c45f6c257ab625118ba77d639104f004b9
|
||||
size 18207
|
BIN
EndlessVendetta/Content/Inventory/MyBaseItem.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Inventory/MyBaseItem.uasset
(Stored with Git LFS)
Binary file not shown.
@ -3,6 +3,13 @@
|
||||
|
||||
#include "BaseItem.h"
|
||||
|
||||
|
||||
void UBaseItem::PostInitProperties()
|
||||
{
|
||||
Super::PostInitProperties();
|
||||
ItemSize = FItemSize(DefaultItemSize.X, DefaultItemSize.Y);
|
||||
}
|
||||
|
||||
void UBaseItem::RotateItem()
|
||||
{
|
||||
if (CurrentItemRotation == Horizontal)
|
||||
|
@ -51,7 +51,9 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
FText Description;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
FItemSize ItemSize = FItemSize();
|
||||
FVector2D DefaultItemSize = FVector2D(1);
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
FItemSize ItemSize;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
UMaterialInterface* ItemTexture;
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
@ -63,6 +65,8 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
|
||||
bool bIsRotated = false;
|
||||
|
||||
virtual void PostInitProperties() override;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Item")
|
||||
void RotateItem();
|
||||
UFUNCTION(BlueprintCallable, Category = "Item")
|
||||
|
@ -109,7 +109,7 @@ bool UInventoryComponent::IsRoomAvailable(UBaseItem* Item, const int TopLeftInde
|
||||
if (!IsTileValid(TileToCheck)) return false;
|
||||
TTuple<UBaseItem*, bool> ItemAtIndex = GetItemAtIndex(TileToIndex(TileToCheck));
|
||||
if (ItemAtIndex.Get<1>()) return false;
|
||||
if (IsValid(ItemAtIndex.Get<0>())) return true;
|
||||
if (IsValid(ItemAtIndex.Get<0>())) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -183,7 +183,7 @@ void UInventoryComponent::SpawnItem(UBaseItem* Item, FVector Location, FRotator
|
||||
|
||||
bool UInventoryComponent::IsTileValid(const FInventoryTile InventoryTile) const
|
||||
{
|
||||
if (InventoryTile.X >= 0 && InventoryTile.Y >= 0 && InventoryTile.Y < Columns && InventoryTile.Y <= Rows)
|
||||
if (InventoryTile.X >= 0 && InventoryTile.Y >= 0 && InventoryTile.X < Columns && InventoryTile.Y < Columns && InventoryTile.Y <= Rows)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user