waffen realoden reapriert
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user