waffen realoden reapriert

This commit is contained in:
NBTEMP\bib
2026-08-20 10:43:24 +02:00
parent e8d6a385c4
commit 4a23cacf12
8 changed files with 84 additions and 69 deletions
+12 -19
View File
@@ -17,6 +17,8 @@ public class WeaponReload : MonoBehaviour
void Update()
{
if (PauseMenu.GameIsPaused) return;
// Während nachgeladen wird, keine Aktionen zulassen
if (isReloading)
return;
@@ -29,30 +31,21 @@ public class WeaponReload : MonoBehaviour
return;
}
// 2. Automatisches Nachladen beim Schießen, wenn das Magazin leer (<= 0) ist
if (Input.GetButtonDown("Fire1"))
{
if (currentAmmo > 0)
{
Shoot();
}
else
{
// Magazin ist leer -> automatisch nachladen!
StartCoroutine(Reload());
}
}
}
void Shoot()
public bool UseAmmo()
{
// Nur schießen, wenn das Pausemenü NICHT offen ist
if (PausenManager.GameIsPaused) return;
if (PauseMenu.GameIsPaused || isReloading) return false;
if (currentAmmo <= 0)
{
StartCoroutine(Reload());
return false;
}
currentAmmo--;
Debug.Log("Schuss gefeuert! Verbleibende Munition: " + currentAmmo);
// Hier deinen normalen Schuss-Code einfügen (Raycast, Bullet-Prefab, Ton etc.)
return true;
}
// Coroutine für die Nachlade-Verzögerung
@@ -73,4 +66,4 @@ public class WeaponReload : MonoBehaviour
isReloading = false;
Debug.Log("Nachladen abgeschlossen! Munition wieder voll: " + currentAmmo);
}
}
}