Compare commits
2 Commits
d3c3bed909
...
469523ac95
Author | SHA1 | Date | |
---|---|---|---|
469523ac95 | |||
|
b1dd559bc0 |
@ -91,6 +91,24 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
|||||||
GameManager.Instance.SetEvents();
|
GameManager.Instance.SetEvents();
|
||||||
SceneManager.sceneLoaded += OnSceneLoaded; // 씬 전환 이벤트
|
SceneManager.sceneLoaded += OnSceneLoaded; // 씬 전환 이벤트
|
||||||
_mealCount = 0; // 식사 횟수 0회
|
_mealCount = 0; // 식사 횟수 0회
|
||||||
|
|
||||||
|
var panel = FindObjectOfType<InteractionAnimationPanelController>();
|
||||||
|
if (panel != null)
|
||||||
|
{
|
||||||
|
PlayerStats.Instance.SetInteractionPanelController(panel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TriggerExhaustion()
|
||||||
|
{
|
||||||
|
if (HealthStat > 0) return;
|
||||||
|
|
||||||
|
Exhaustion?.Invoke(); // 탈진 이벤트 발생
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionAnimationPanelController GetInteractionPanelController()
|
||||||
|
{
|
||||||
|
return _interactionAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 말풍선(Bubble) 관련
|
#region 말풍선(Bubble) 관련
|
||||||
@ -373,7 +391,8 @@ public class PlayerStats : MonoBehaviour,ISaveable
|
|||||||
|
|
||||||
// 탈진 이벤트 발생
|
// 탈진 이벤트 발생
|
||||||
Debug.Log("탈진! 체력 0");
|
Debug.Log("탈진! 체력 0");
|
||||||
Exhaustion?.Invoke();
|
GameManager.Instance.gotoBed = true;
|
||||||
|
Invoke(nameof(TriggerExhaustion), 4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HealthStat > MaxHealth)
|
if (HealthStat > MaxHealth)
|
||||||
|
@ -72,6 +72,11 @@ public class ChatWindowController : MonoBehaviour, IPointerClickHandler
|
|||||||
|
|
||||||
_dialogueManager = new FairyDialogueManager(this);
|
_dialogueManager = new FairyDialogueManager(this);
|
||||||
|
|
||||||
|
onComplete = () =>
|
||||||
|
{
|
||||||
|
GameManager.Instance.gotoBed = true;
|
||||||
|
};
|
||||||
|
|
||||||
onComplete = () => {
|
onComplete = () => {
|
||||||
if (isTuto)
|
if (isTuto)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,9 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
|
|
||||||
private TutorialManager tutorialManager;
|
private TutorialManager tutorialManager;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public bool gotoBed = false;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// 오디오 초기화
|
// 오디오 초기화
|
||||||
@ -36,6 +39,13 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
//패널 매니저 생성
|
//패널 매니저 생성
|
||||||
panelManager = Instantiate(Resources.Load<GameObject>("Prefabs/PanelManager")).GetComponent<PanelManager>();
|
panelManager = Instantiate(Resources.Load<GameObject>("Prefabs/PanelManager")).GetComponent<PanelManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator DelayedForcedSleep(float delay)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(delay);
|
||||||
|
PlayerStats.Instance.PerformAction(ActionType.ForcedSleep);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region 대화 관련
|
#region 대화 관련
|
||||||
|
|
||||||
@ -46,6 +56,8 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
|
|
||||||
private IEnumerator StartNPCDialogueCoroutine(GamePhase phase)
|
private IEnumerator StartNPCDialogueCoroutine(GamePhase phase)
|
||||||
{
|
{
|
||||||
|
gotoBed = false;
|
||||||
|
|
||||||
if (chatWindowController == null)
|
if (chatWindowController == null)
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(4.0f); // 씬 전환 대기
|
yield return new WaitForSeconds(4.0f); // 씬 전환 대기
|
||||||
@ -78,7 +90,8 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
public void SetEvents()
|
public void SetEvents()
|
||||||
{
|
{
|
||||||
PlayerStats.Instance.OnDayEnded += AdvanceDay; // 날짜 변경
|
PlayerStats.Instance.OnDayEnded += AdvanceDay; // 날짜 변경
|
||||||
PlayerStats.Instance.ZeroReputation += ZeroReputationEnd; // 평판 0 엔딩
|
PlayerStats.Instance.ZeroReputation += ZeroReputationEnd;
|
||||||
|
PlayerStats.Instance.Exhaustion += ExhaustionToSleep;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 날짜 진행
|
// 날짜 진행
|
||||||
@ -93,10 +106,61 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
TriggerTimeEnding();
|
TriggerTimeEnding();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 탈진
|
||||||
|
private void ExhaustionToSleep()
|
||||||
|
{
|
||||||
|
StartCoroutine(WaitOtherEvents());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator WaitOtherEvents()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(Time.deltaTime);
|
||||||
|
|
||||||
|
// 로딩 중이거나 던전/메인 씬이면 탈진 실행 보류
|
||||||
|
string currentScene = SceneManager.GetActiveScene().name;
|
||||||
|
if (currentScene != "ReHousing")
|
||||||
|
{
|
||||||
|
StartCoroutine(WaitOtherEvents()); // 다시 기다림
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gotoBed)
|
||||||
|
{
|
||||||
|
var panel = PlayerStats.Instance.GetInteractionPanelController();
|
||||||
|
|
||||||
|
if (panel != null)
|
||||||
|
{
|
||||||
|
panel.ShowAnimationPanel(ActionType.Sleep, "탈진했습니다");
|
||||||
|
GameManager.Instance.StartCoroutine(DelayedForcedSleep(2.0f)); // 애니메이션 끝나고 강제 수면 처리
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerStats.Instance.PerformAction(ActionType.ForcedSleep);
|
||||||
|
}
|
||||||
|
|
||||||
|
gotoBed = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartCoroutine(WaitOtherEvents());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeToMainScene()
|
public void ChangeToMainScene()
|
||||||
{
|
{
|
||||||
SceneManager.LoadScene("Main");
|
SceneManager.LoadScene("Main");
|
||||||
|
StartCoroutine(CheckDungeonScene());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator CheckDungeonScene()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(Time.deltaTime);
|
||||||
|
|
||||||
|
if (SceneManager.GetActiveScene().name == "ReDungeon")
|
||||||
|
gotoBed = false;
|
||||||
|
else
|
||||||
|
StartCoroutine(CheckHomeScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeToGameScene()
|
public void ChangeToGameScene()
|
||||||
@ -120,9 +184,20 @@ public partial class GameManager : Singleton<GameManager>,ISaveable
|
|||||||
if(isNewStart) // 아예 메인에서 시작 시 튜토리얼 출력
|
if(isNewStart) // 아예 메인에서 시작 시 튜토리얼 출력
|
||||||
StartNPCDialogue(GamePhase.Intro);
|
StartNPCDialogue(GamePhase.Intro);
|
||||||
|
|
||||||
|
StartCoroutine(CheckHomeScene());
|
||||||
if (tryStageCount >= 3) FailEnd(); // 엔딩
|
if (tryStageCount >= 3) FailEnd(); // 엔딩
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator CheckHomeScene()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(Time.deltaTime);
|
||||||
|
|
||||||
|
if (SceneManager.GetActiveScene().name == "ReHousing")
|
||||||
|
gotoBed = true;
|
||||||
|
else
|
||||||
|
StartCoroutine(CheckHomeScene());
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerator StartTutorialCoroutine()
|
public IEnumerator StartTutorialCoroutine()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(0.5f);
|
yield return new WaitForSeconds(0.5f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user