From aab3fbc5746b669973a9b30e3a0b09f96b82acd0 Mon Sep 17 00:00:00 2001 From: nlevin6 Date: Wed, 16 Apr 2025 20:27:08 -0400 Subject: [PATCH] bug fix: check if inventory is full --- Assets/Scripts/PickUpKeyCard.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/Scripts/PickUpKeyCard.cs b/Assets/Scripts/PickUpKeyCard.cs index 1ecdbe91..b2fed543 100644 --- a/Assets/Scripts/PickUpKeyCard.cs +++ b/Assets/Scripts/PickUpKeyCard.cs @@ -46,6 +46,24 @@ public class PickUpKeyCard : MonoBehaviour 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; if (keyCardPlayer != null)