using UnityEngine; using System.Collections.Generic; /* -------------------------------------- Project: Programing assessment Standard: 91906 (AS3.7) v.1 School: Tauranga Boys' College Author: Rauputu Noah Phizacklea Date: August 2024 Unity: 2021.3.18f --------------------------------------- */ public class Inventory : MonoBehaviour { public static Inventory Instance { get; private set; } // Singleton instance public HashSet keys = new HashSet(); // Set of collected keys public bool[] isFull; // Array to check if inventory slots are full public GameObject[] slots; // Array of inventory slot GameObjects private void Awake() { if (Instance == null) { Instance = this; // Set this as the singleton instance } else if (Instance != this) { Destroy(gameObject); // Destroy duplicate instances } } public void AddKey(string keyID) { keys.Add(keyID); // Add a key to the inventory } public bool HasKey(string keyID) { return keys.Contains(keyID); // Check if the key exists in the inventory } }