From d941326d617174861dd57970f8a4d83dd1e6b396 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Thu, 15 May 2025 09:32:02 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=EB=B3=91=ED=95=A9=20=EC=B6=A9=EB=8F=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Common/GameManager.cs | 31 +++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Common/GameManager.cs b/Assets/Scripts/Common/GameManager.cs index 07ba2b5e..e1422913 100644 --- a/Assets/Scripts/Common/GameManager.cs +++ b/Assets/Scripts/Common/GameManager.cs @@ -26,6 +26,8 @@ public partial class GameManager : Singleton,ISaveable private PanelManager panelManager; public PanelManager PanelManager => panelManager; + private TutorialManager tutorialManager; + private void Start() { // 오디오 초기화 @@ -91,24 +93,45 @@ public partial class GameManager : Singleton,ISaveable TriggerTimeEnding(); } } + + public void ChangeToMainScene() + { + SceneManager.LoadScene("Main"); + } public void ChangeToGameScene() { tryStageCount++; // 던전 시도 횟수 증가 InteractionController interactionController = FindObjectOfType(); interactionController.ReSetAfterWorkEvent(); - SceneManager.LoadScene("ReDungeon"); // 던전 Scene + var switchingPanel = PanelManager.GetPanel("SwitchingPanel").GetComponent(); + switchingPanel.FadeAndSceneLoad("ReDungeon"); // 던전 Scene HandleSceneAudio("Dungeon"); } - public void ChangeToHomeScene() + public void ChangeToHomeScene(bool isNewStart = false) { - SceneManager.LoadScene("ReHousing"); // Home Scene + var switchingPanel = PanelManager.GetPanel("SwitchingPanel").GetComponent(); + switchingPanel.FadeAndSceneLoad("ReHousing"); // Home Scene HandleSceneAudio("Housing"); + if(isNewStart) // 아예 메인에서 시작 시 튜토리얼 출력 + StartNPCDialogue(GamePhase.Intro); // StartCoroutine(StartTutorialCoroutine()); + if (tryStageCount >= 3) FailEnd(); // 엔딩 } + public IEnumerator StartTutorialCoroutine() + { + yield return new WaitForSeconds(0.5f); + + if(tutorialManager == null) + tutorialManager = FindObjectOfType(); + + PlayerStats.Instance.HideBubble(); + tutorialManager.StartTutorial(() => PlayerStats.Instance.ShowBubble()); + } + // TODO: Open Setting Panel 등 Panel 처리 protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode) @@ -135,6 +158,7 @@ public partial class GameManager : Singleton,ISaveable if (save?.dungeonSave != null) { stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2); + tryStageCount = Mathf.Clamp(save.dungeonSave.tryStageCount,0,3); } if (save?.homeSave != null) @@ -150,6 +174,7 @@ public partial class GameManager : Singleton,ISaveable dungeonSave = new DungeonSave() { stageLevel = Mathf.Clamp(this.stageLevel,1,2), + tryStageCount = Mathf.Clamp(this.tryStageCount,0,3), }, homeSave = new HomeSave