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
+20 -5
View File
@@ -6,14 +6,19 @@ public class PauseMenu : MonoBehaviour
public GameObject pauseMenuUI; // Das Pausenmenü-Panel
public GameObject hudUI; // Die Lebens- und Munitionsanzeige (HUD)
private bool isPaused = false;
public static bool GameIsPaused = false;
void Start()
{
ResumeGame();
}
void Update()
{
// Überprüft, ob die ESC-Taste gedrückt wurde
if (Input.GetKeyDown(KeyCode.Escape))
{
if (isPaused)
if (GameIsPaused)
{
ResumeGame();
}
@@ -29,7 +34,7 @@ public class PauseMenu : MonoBehaviour
pauseMenuUI.SetActive(true); // Pausenmenü anzeigen
hudUI.SetActive(false); // Lebens- & Munitionsanzeige ausblenden
Time.timeScale = 0f; // Spielzeit anhalten
isPaused = true;
GameIsPaused = true;
// MAUSZEIGER FREIGEBEN (damit man Knöpfe drücken kann)
Cursor.lockState = CursorLockMode.None;
@@ -41,10 +46,20 @@ public class PauseMenu : MonoBehaviour
pauseMenuUI.SetActive(false); // Pausenmenü ausblenden
hudUI.SetActive(true); // Lebens- & Munitionsanzeige wieder anzeigen
Time.timeScale = 1f; // Spielzeit weiterlaufen lassen
isPaused = false;
GameIsPaused = false;
// MAUSZEIGER WIEDER SPERREN (fürs Gameplay)
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
}
public void QuitGame()
{
Time.timeScale = 1f;
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}