Weapon inventory manager fix

This commit is contained in:
Marco 2025-06-26 08:44:24 +02:00
commit 357ced3e94

View file

@ -41,7 +41,7 @@ public partial class Weapon3D : Node3D
private set private set
{ {
_loadedAmmo = value; _loadedAmmo = value;
_inventoryManager?.NotifyLoadedAmmoChange(WeaponData?.ItemKey, _loadedAmmo); InventoryManager.Instance?.NotifyLoadedAmmoChange(WeaponData?.ItemKey, _loadedAmmo);
} }
} }
@ -51,8 +51,6 @@ public partial class Weapon3D : Node3D
private GameManager _gameManager; private GameManager _gameManager;
private InventoryManager _inventoryManager;
private readonly StringName _shieldAmmoType = "SHIELD"; private readonly StringName _shieldAmmoType = "SHIELD";
private bool UsesBattery => WeaponData.AmmoKey == _shieldAmmoType; private bool UsesBattery => WeaponData.AmmoKey == _shieldAmmoType;
@ -80,7 +78,7 @@ public partial class Weapon3D : Node3D
} }
else else
{ {
var ammoToLoad = _inventoryManager.RemoveItem(WeaponData.AmmoKey, WeaponData.BulletCapacity - LoadedAmmo); var ammoToLoad = InventoryManager.Instance.RemoveItem(WeaponData.AmmoKey, WeaponData.BulletCapacity - LoadedAmmo);
if (ammoToLoad > 0) if (ammoToLoad > 0)
{ {