From d5c10752694c3f13d56b2d6e8864f0c3e7c2fe63 Mon Sep 17 00:00:00 2001 From: Sehyeon Date: Mon, 21 Apr 2025 16:02:56 +0900 Subject: [PATCH] =?UTF-8?q?DEG-15=20[Feat]=20=EC=8A=A4=ED=83=AF=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=93=B1=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/PlayerStats.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index 59a2ff09..0766c619 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -6,6 +6,20 @@ using Random = UnityEngine.Random; public class PlayerStats : MonoBehaviour { + public class StatsChangeData // 변경된 스탯 데이터 + { + public float Time { get; } + public float Health { get; } + public float Reputation { get; } + + public StatsChangeData(float time, float health, float reputation) + { + Time = time; + Health = health; + Reputation = reputation; + } + } + private GameConstants _gameConstants; private ValueByAction _valueByAction; @@ -17,6 +31,8 @@ public class PlayerStats : MonoBehaviour public event Action Exhaustion; // 탈진 public event Action Overslept; // 결근(늦잠) public event Action ZeroReputation; // 평판 0 이벤트 + public event Action OnStatsChanged; // 스탯 변경 이벤트 + public event Action OnWorked; // 퇴근 이벤트 (출근 이후 집에 돌아올 시간에 발생) private float previousAddHealth = 0f; @@ -49,6 +65,15 @@ public class PlayerStats : MonoBehaviour ModifyTime(effect.timeChange, actionType); ModifyHealth(effect.healthChange); ModifyReputation(effect.reputationChange); + + // 스탯 변경 이벤트 (UI 업데이트용) + OnStatsChanged?.Invoke(new StatsChangeData(TimeStat, HealthStat, ReputationStat)); + + // 스탯 - 시간이 변경된 이후 퇴근 이벤트 발생 + if (actionType == ActionType.Work) + { + OnWorked?.Invoke(); + } } // 출근 가능 여부 확인 메서드