void SetupWeaponInventory() { // If not empty if (WeaponsInventory.Count > 0) { WeaponsInventory.Clear(); } // Add all weapons var weapons = GameObject.FindGameObjectsWithTag("Weapon"); // Adding all the weapons to the inventory foreach (var weapon in weapons) { var weaponScript = weapon.GetComponent <Weapon>(); WeaponsInventory.Add(weaponScript.WeaponID, weaponScript); // Set all weapons besides the currently equipped one to inactive if (weaponScript.WeaponID == ActiveWeaponID) { // Set ammo to the first weapon weapon.SetActive(true); weaponScript.setAmmoText(); } else { weapon.SetActive(false); } } }
//Weapons public void AddWeaponToInventory(Weapon weapon) { WeaponsInventory.Add(weapon.WeaponID, weapon); }