From fcefa8fd718913c9602ff8c8be261344a41edac4 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Thu, 11 Jan 2024 22:15:59 -0500 Subject: [PATCH] chore: add method to get the cell at a given location in inventory grid space. --- Code/Grid/InventoryGrid.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Code/Grid/InventoryGrid.cs b/Code/Grid/InventoryGrid.cs index 2a49ea2..7ecc751 100644 --- a/Code/Grid/InventoryGrid.cs +++ b/Code/Grid/InventoryGrid.cs @@ -161,6 +161,16 @@ public class InventoryGrid SetCellAreaState((Vector2)position, item.Size, EnumInventoryGridCellState.Unavailable); return true; } + + /// + /// Gets the cell at the given location in inventory grid space. + /// + /// The position you want to get the cell of. + /// The inventory cell. + public InventoryCell? GetCell(Vector2 position) + { + return _gridCells.FirstOrDefault(cell => cell.Position == position); + } #endregion } \ No newline at end of file