bug fix: check if inventory is full
All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 5m23s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 5m19s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 10s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 11s

This commit is contained in:
nlevin6 2025-04-16 20:27:08 -04:00
parent 41fd90aced
commit aab3fbc574

View File

@ -46,6 +46,24 @@ public class PickUpKeyCard : MonoBehaviour
if (Input.GetMouseButtonDown(0)) if (Input.GetMouseButtonDown(0))
{ {
bool hasSpace = false;
foreach (var slot in playerInventory.slots)
{
if (slot == null)
{
hasSpace = true;
break;
}
}
if (!hasSpace)
{
Debug.Log("Inventory is full!");
if (interactionPrompt != null)
interactionPrompt.text = "Inventory full!";
return;
}
isPickedUp = true; isPickedUp = true;
if (keyCardPlayer != null) if (keyCardPlayer != null)