From c3ade04d2dcbb419a157b0c3bac7b1a2354bcea9 Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 17:23:33 +0900 Subject: [PATCH 1/6] =?UTF-8?q?DEG-168=20[FEAT]=20=EB=8F=8C=EB=B0=9C?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=ED=9B=84=20=EA=B0=95=EC=A0=9C?= =?UTF-8?q?=EC=88=99=EB=A9=B4,=20=EC=83=9D=ED=99=9C=20=EB=8A=A5=EB=A0=A5?= =?UTF-8?q?=EC=B9=98=20=EC=97=85=EA=B7=B8=EB=A0=88=EC=9D=B4=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/PlayerStats.cs | 44 +++++++++++++++---- Assets/KSH/StatPanelController.cs | 4 +- Assets/KSH/ValueByAction.cs | 2 +- .../DailyRoutine/InteractionController.cs | 12 ++++- .../LIN/Scripts/UI/HousingCanvasController.cs | 37 ++++++++++++++++ .../UI/InteractionAnimationPanelController.cs | 5 ++- 6 files changed, 88 insertions(+), 16 deletions(-) diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index b3690490..a6f7a308 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -39,6 +39,11 @@ public class PlayerStats : MonoBehaviour,ISaveable public static PlayerStats Instance; + private float additionalMaxHealth = 0f; + public float MaxHealth => _gameConstants.maxHealth + additionalMaxHealth; + + public ActionType LastAction { get; private set; } + // 결근 이벤트 관련 변수 private bool _hasWorkedToday = false; public bool HasWorkedToday => _hasWorkedToday; @@ -203,16 +208,29 @@ public class PlayerStats : MonoBehaviour,ISaveable { // 액션에 따른 스탯 소모 값 가져오기 ActionEffect effect = _valueByAction.GetActionEffect(actionType); - - // 스탯 변경 적용 + LastAction = actionType; + // 선 처리: 특수 보상 먼저 (야근, 회식) + if (actionType == ActionType.OvertimeWork) + { + additionalMaxHealth += 1f; + } + else if (actionType == ActionType.TeamDinner) + { + ModifyReputation(1f); + } + + // 순수 스탯 변경 적용 ModifyTime(effect.timeChange, actionType); ModifyHealth(effect.healthChange); - ModifyReputation(effect.reputationChange); - - // 스탯 변경 이벤트 (UI 업데이트용) + if (Mathf.Abs(effect.reputationChange) > 0.01f) + { + ModifyReputation(effect.reputationChange); + } + + // UI 업데이트용 OnStatsChanged?.Invoke(new StatsChangeData(TimeStat, HealthStat, ReputationStat)); - // 스탯 - 시간이 변경된 이후 퇴근 이벤트 발생 + // 출근 후 퇴근 이벤트 발생 if (actionType == ActionType.Work) { _hasWorkedToday = true; @@ -223,8 +241,16 @@ public class PlayerStats : MonoBehaviour,ISaveable { _mealCount++; } + + // 다음 날로 넘기기 처리 + bool shouldForceEndDay = actionType == ActionType.OvertimeWork || actionType == ActionType.TeamDinner; + if (shouldForceEndDay || TimeStat >= _gameConstants.maxTime) + { + EndDay(effect.timeChange, actionType); + } } + public bool CanEat() { return _mealCount < MAX_MEAL_COUNT; // 식사 횟수 0,1 일 때만 true @@ -245,7 +271,7 @@ public class PlayerStats : MonoBehaviour,ISaveable bool isDayEnded = false; // 수면 행동 처리 - if (actionType == ActionType.Sleep || actionType == ActionType.TeamDinner) // 다음 날 오전 8시 기상 + if (actionType == ActionType.Sleep || actionType == ActionType.TeamDinner || actionType == ActionType.OvertimeWork) // 다음 날 오전 8시 기상 { // 다음 날 오전 8시 - 현재 시간 값 float nowTime = TimeStat - time; @@ -356,9 +382,9 @@ public class PlayerStats : MonoBehaviour,ISaveable Exhaustion?.Invoke(); } - if (HealthStat > _gameConstants.maxHealth) + if (HealthStat > MaxHealth) { - HealthStat = _gameConstants.maxHealth; + HealthStat = MaxHealth; } } diff --git a/Assets/KSH/StatPanelController.cs b/Assets/KSH/StatPanelController.cs index 74e93fbb..a9e5586a 100644 --- a/Assets/KSH/StatPanelController.cs +++ b/Assets/KSH/StatPanelController.cs @@ -54,8 +54,8 @@ public class StatPanelController : MonoBehaviour private void SetStat(float time, float reputation, float health) { - healthBarImage.fillAmount = health / _gameConstants.maxHealth; - healthText.text = $"{health}/{_gameConstants.maxHealth}"; + healthBarImage.fillAmount = health / PlayerStats.Instance.MaxHealth; + healthText.text = $"{health}/{PlayerStats.Instance.MaxHealth}"; reputationBarImage.fillAmount = reputation / _gameConstants.maxReputation; reputationText.text = $"{reputation}/{_gameConstants.maxReputation}"; diff --git a/Assets/KSH/ValueByAction.cs b/Assets/KSH/ValueByAction.cs index 594f0b7f..00ee1b1e 100644 --- a/Assets/KSH/ValueByAction.cs +++ b/Assets/KSH/ValueByAction.cs @@ -40,7 +40,7 @@ public class ValueByAction { ActionType.Work, new ActionEffect(+10.0f, -3.0f, +0.2f) }, // 8to6: 10시간 { ActionType.Dungeon, new ActionEffect(+3.0f, -3.0f, 0) }, { ActionType.Housework, new ActionEffect(+1.0f, -1.0f, +0.2f) }, - { ActionType.OvertimeWork, new ActionEffect(+4.0f, -5.0f, +1.0f) }, + { ActionType.OvertimeWork, new ActionEffect(_gameConstants.forcedValue, -5.0f, +1.0f) }, { ActionType.TeamDinner, new ActionEffect(_gameConstants.forcedValue, _gameConstants.forcedValue, 0) }, // 수면 강제(8시 기상) 후 최대 체력 { ActionType.Absence, new ActionEffect(0, 0, -3.0f) } }; diff --git a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs index 951ad303..bcb349ea 100644 --- a/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs +++ b/Assets/LIN/Scripts/DailyRoutine/InteractionController.cs @@ -137,11 +137,19 @@ public class InteractionController : MonoBehaviour PlayerStats.Instance.PerformAction(ActionType.TeamDinner); } - housingCanvasController.ShowSuddenEventImage(afterWorkEventType); GameManager.Instance.PlaySuddenEventSound(afterWorkEventType); + // 야근 or 회식 돌발 이벤트 실행 시 + housingCanvasController.ShowSuddenEventImageWithCallback(afterWorkEventType, () => + { + // 이미지 다 보여진 후 실행 + interactionAnimationPanelController.ShowAnimationPanel( + ActionType.Sleep, + "너무 피곤해서 그대로 잠들어 버렸다..." + ); + }); }); } - + #endregion } diff --git a/Assets/LIN/Scripts/UI/HousingCanvasController.cs b/Assets/LIN/Scripts/UI/HousingCanvasController.cs index 1839b0ef..c5f82a6e 100644 --- a/Assets/LIN/Scripts/UI/HousingCanvasController.cs +++ b/Assets/LIN/Scripts/UI/HousingCanvasController.cs @@ -125,6 +125,43 @@ public class HousingCanvasController : MonoBehaviour _autoHideCoroutine = StartCoroutine(AutoHideSuddenImage(afterWorkEventType)); } + + public void ShowSuddenEventImageWithCallback(AfterWorkEventType afterWorkEventType, Action onComplete) + { + if (_autoHideCoroutine != null) + StopCoroutine(_autoHideCoroutine); + + switch (afterWorkEventType) + { + case AfterWorkEventType.OvertimeWork: + suddenEventImages[0].SetActive(true); + break; + case AfterWorkEventType.TeamGathering: + suddenEventImages[1].SetActive(true); + break; + } + + _autoHideCoroutine = StartCoroutine(AutoHideSuddenImageWithCallback(afterWorkEventType, onComplete)); + } + + private IEnumerator AutoHideSuddenImageWithCallback(AfterWorkEventType type, Action onComplete) + { + float startTime = Time.time; + while (Time.time - startTime < HousingConstants.SUDDENEVENT_IAMGE_SHOW_TIME) + { + if (Input.touchCount > 0 || Input.GetMouseButtonDown(0)) + break; + + yield return null; + } + + HideSuddenEventImage(); + HideSuddenEventPanel(); + GameManager.Instance.StopSuddenEventSound(type); + + _autoHideCoroutine = null; + onComplete?.Invoke(); + } public void HideSuddenEventImage() { diff --git a/Assets/LIN/Scripts/UI/InteractionAnimationPanelController.cs b/Assets/LIN/Scripts/UI/InteractionAnimationPanelController.cs index 9f999c8e..4f627b56 100644 --- a/Assets/LIN/Scripts/UI/InteractionAnimationPanelController.cs +++ b/Assets/LIN/Scripts/UI/InteractionAnimationPanelController.cs @@ -33,8 +33,9 @@ public class InteractionAnimationPanelController : MonoBehaviour public void ShowAnimationPanel(ActionType actionType, string animationText) { PlayerStats.Instance.HideBubble(); - - if (actionType == ActionType.Sleep && !PlayerStats.Instance.HasWorkedToday) // 결근 + if (actionType == ActionType.Sleep && !PlayerStats.Instance.HasWorkedToday + && PlayerStats.Instance.LastAction != ActionType.TeamDinner + && PlayerStats.Instance.LastAction != ActionType.OvertimeWork) // 결근 { _isAbsenceToday = true; } -- 2.47.1 From 174a805812ebc9b67877b17828a9d54c82e7118c Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 17:29:11 +0900 Subject: [PATCH 2/6] =?UTF-8?q?DEG-168=20[MERGE]=20=EC=B6=A9=EB=8F=8C=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=A7=8C=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/ValueByAction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/KSH/ValueByAction.cs b/Assets/KSH/ValueByAction.cs index 00ee1b1e..7c62729f 100644 --- a/Assets/KSH/ValueByAction.cs +++ b/Assets/KSH/ValueByAction.cs @@ -41,7 +41,7 @@ public class ValueByAction { ActionType.Dungeon, new ActionEffect(+3.0f, -3.0f, 0) }, { ActionType.Housework, new ActionEffect(+1.0f, -1.0f, +0.2f) }, { ActionType.OvertimeWork, new ActionEffect(_gameConstants.forcedValue, -5.0f, +1.0f) }, - { ActionType.TeamDinner, new ActionEffect(_gameConstants.forcedValue, _gameConstants.forcedValue, 0) }, // 수면 강제(8시 기상) 후 최대 체력 + { ActionType.TeamDinner, new ActionEffect(_gameConstants.forcedValue, +8.0f, 0) }, // 수면 강제(8시 기상) 후 최대 체력 { ActionType.Absence, new ActionEffect(0, 0, -3.0f) } }; } -- 2.47.1 From 418d22062c6fabed46eac5b85742ca2159465759 Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 17:31:16 +0900 Subject: [PATCH 3/6] =?UTF-8?q?DEG-168=20[MERGE]=20=EC=B6=A9=EB=8F=8C=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20main=EA=B1=B8=EB=A1=9C=20=EB=B3=91?= =?UTF-8?q?=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/ValueByAction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/KSH/ValueByAction.cs b/Assets/KSH/ValueByAction.cs index 7c62729f..ac6d84fb 100644 --- a/Assets/KSH/ValueByAction.cs +++ b/Assets/KSH/ValueByAction.cs @@ -40,7 +40,7 @@ public class ValueByAction { ActionType.Work, new ActionEffect(+10.0f, -3.0f, +0.2f) }, // 8to6: 10시간 { ActionType.Dungeon, new ActionEffect(+3.0f, -3.0f, 0) }, { ActionType.Housework, new ActionEffect(+1.0f, -1.0f, +0.2f) }, - { ActionType.OvertimeWork, new ActionEffect(_gameConstants.forcedValue, -5.0f, +1.0f) }, + { ActionType.OvertimeWork, new ActionEffect(+4.0f, -5.0f, +1.0f) }, { ActionType.TeamDinner, new ActionEffect(_gameConstants.forcedValue, +8.0f, 0) }, // 수면 강제(8시 기상) 후 최대 체력 { ActionType.Absence, new ActionEffect(0, 0, -3.0f) } }; -- 2.47.1 From 9b134425a548ca18d3ae1ff67ee289ab9c68c969 Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 17:36:33 +0900 Subject: [PATCH 4/6] =?UTF-8?q?DEG-168=20[FIX]=20=ED=94=BC=EB=93=9C?= =?UTF-8?q?=EB=B0=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/PlayerStats.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index a6f7a308..edc316f2 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -210,14 +210,10 @@ public class PlayerStats : MonoBehaviour,ISaveable ActionEffect effect = _valueByAction.GetActionEffect(actionType); LastAction = actionType; // 선 처리: 특수 보상 먼저 (야근, 회식) - if (actionType == ActionType.OvertimeWork) + if (actionType == ActionType.TeamDinner) { additionalMaxHealth += 1f; } - else if (actionType == ActionType.TeamDinner) - { - ModifyReputation(1f); - } // 순수 스탯 변경 적용 ModifyTime(effect.timeChange, actionType); -- 2.47.1 From a154bba994f3304fbac3693be0a8cc2b03f1e5db Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 18:00:48 +0900 Subject: [PATCH 5/6] =?UTF-8?q?DEG-168=20[FIX]=20=ED=94=BC=EB=93=9C?= =?UTF-8?q?=EB=B0=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/PlayerStats.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index edc316f2..addc5bdc 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -237,13 +237,6 @@ public class PlayerStats : MonoBehaviour,ISaveable { _mealCount++; } - - // 다음 날로 넘기기 처리 - bool shouldForceEndDay = actionType == ActionType.OvertimeWork || actionType == ActionType.TeamDinner; - if (shouldForceEndDay || TimeStat >= _gameConstants.maxTime) - { - EndDay(effect.timeChange, actionType); - } } -- 2.47.1 From 2e434f56413e59560181f10c9a59ff394c9862ca Mon Sep 17 00:00:00 2001 From: Jay <96156114+jaydev00a@users.noreply.github.com> Date: Wed, 14 May 2025 18:03:54 +0900 Subject: [PATCH 6/6] =?UTF-8?q?DEG-168=20[FIX]=20=ED=94=BC=EB=93=9C?= =?UTF-8?q?=EB=B0=B1=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/PlayerStats.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index addc5bdc..42192c68 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -218,10 +218,7 @@ public class PlayerStats : MonoBehaviour,ISaveable // 순수 스탯 변경 적용 ModifyTime(effect.timeChange, actionType); ModifyHealth(effect.healthChange); - if (Mathf.Abs(effect.reputationChange) > 0.01f) - { - ModifyReputation(effect.reputationChange); - } + ModifyReputation(effect.reputationChange); // UI 업데이트용 OnStatsChanged?.Invoke(new StatsChangeData(TimeStat, HealthStat, ReputationStat)); -- 2.47.1