mirror of
https://github.com/D4M13N-D3V/godot_grid_inventory.git
synced 2025-03-14 08:14:55 +00:00
chore: add method to get the cell at a given location in inventory grid space.
This commit is contained in:
parent
d3c207e8f2
commit
fcefa8fd71
@ -161,6 +161,16 @@ public class InventoryGrid
|
||||
SetCellAreaState((Vector2)position, item.Size, EnumInventoryGridCellState.Unavailable);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cell at the given location in inventory grid space.
|
||||
/// </summary>
|
||||
/// <param name="position">The position you want to get the cell of.</param>
|
||||
/// <returns>The inventory cell.</returns>
|
||||
public InventoryCell? GetCell(Vector2 position)
|
||||
{
|
||||
return _gridCells.FirstOrDefault(cell => cell.Position == position);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user