From 884103d805270bd776b7a485d9431401c0c05594 Mon Sep 17 00:00:00 2001 From: miepzerino <o.skotnik@gmail.com> Date: Sun, 30 Mar 2025 18:50:13 +0000 Subject: [PATCH] #16 added ores to player inventory #14 show inventory in UI --- Assets/Scripts/PauseMenu.cs | 47 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 33 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs index cf748c7..7227f6f 100644 --- a/Assets/Scripts/PauseMenu.cs +++ b/Assets/Scripts/PauseMenu.cs @@ -7,22 +7,23 @@ public class PauseMenu : MonoBehaviour { - public static bool GameIsPaused = false; public GameObject pauseMenuUI; public GameObject settingsMenuUI; public GameObject pausePanel; + public GameObject saveGameText; + Animator animator; private void Awake() { - GameIsPaused = false; + animator = GetComponent<Animator>(); } public void OnEscapedPressed(InputAction.CallbackContext context) { if (context.started) { - ResumeOrPauseGame(GameIsPaused); + ResumeOrPauseGame(GameManager.GameIsPaused); } } @@ -30,33 +31,51 @@ { if (resume) { - Resume(); + ResumeWithMenu(); } else { - Pause(); + PauseWithMenu(); } } - private void Resume() + private void ResumeWithMenu() { - // TODO make it dynamic (whichever UI is activ set it to falsen when unpaused) + // TODO make it dynamic (whichever UI is activ set it to false when unpaused) + GameManager.ResumeGame(); pausePanel.SetActive(false); - Time.timeScale = 1f; - GameIsPaused = false; } - private void Pause() + private void PauseWithMenu() { + GameManager.PauseGame(); settingsMenuUI.SetActive(false); pauseMenuUI.SetActive(true); pausePanel.SetActive(true); - Time.timeScale = 0f; - GameIsPaused = true; } + public void OnResumeClicked() { - Resume(); + GameManager.ResumeGame(); + } + + public void OnGameSaveClicked() + { + PlayerController playerController = GameObject.Find("Player").GetComponent<PlayerController>(); + SaveSystem.SavePlayer(new SaveDataPlayer(playerController)); + GameManager gameManager= GameObject.Find("GameManager").GetComponent<GameManager>(); + SaveSystem.SaveMapState(new SaveDataMap(gameManager.destroyedTiles, gameManager.generateTileMap.seed.Value)); + animator.SetTrigger("GameSaved"); + } + + public void OnSettingsSaveClicked() + { + animator.SetTrigger("GameSettingsSaved"); + } + + public void OnGamedLoaded() + { + animator.SetTrigger("GameLoaded"); } public void OnMenuClicked() @@ -66,7 +85,7 @@ public void OnExitClicked() { - Resume(); + GameManager.ResumeGame(); SceneManager.LoadScene("MainMenu"); } -- Gitblit v1.9.3