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