From b7950b4fc26c3ac469295e3025400cdc5e7b95f3 Mon Sep 17 00:00:00 2001 From: icetea1110 Date: Fri, 3 Apr 2026 14:13:59 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20SO=5FDungeonState=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Fantasy-Grower/Assets/Scripts/Dungeon.meta | 8 +++++ .../Assets/Scripts/Dungeon/SO_DungeonState.cs | 36 +++++++++++++++++++ .../Scripts/Dungeon/SO_DungeonState.cs.meta | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 Fantasy-Grower/Assets/Scripts/Dungeon.meta create mode 100644 Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs create mode 100644 Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs.meta diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon.meta b/Fantasy-Grower/Assets/Scripts/Dungeon.meta new file mode 100644 index 0000000..0184fea --- /dev/null +++ b/Fantasy-Grower/Assets/Scripts/Dungeon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 54f89240703479c4aac198efdadf69c3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs new file mode 100644 index 0000000..3f4ca44 --- /dev/null +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs @@ -0,0 +1,36 @@ +using System; +using UnityEngine; + +public enum DungeonState +{ + None, + Start, + InProgress, + Failed, + Completed, +} + +public class SO_DungeonState : ScriptableObject +{ + private DungeonState currentState; + + /// + /// 상태 변경 시 이벤트를 발생시키는 프로퍼티 + /// + public DungeonState DungeonState + { + get => currentState; + set + { + if (currentState == value) + return; + currentState = value; + OnDungeonStateChanged?.Invoke(currentState); + } + } + + /// + /// 사용 예 : state.OnDungeonStateChanged += (newState) => { Debug.Log($"Dungeon state changed to: {newState}"); }; + /// + public event Action OnDungeonStateChanged; +} diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs.meta b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs.meta new file mode 100644 index 0000000..0a0503b --- /dev/null +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f519d2f876e2d2544aa07bf492a39730 \ No newline at end of file From 27beffb05f9ee9b8db1e2bcc5c0b31ce6addb6d8 Mon Sep 17 00:00:00 2001 From: icetea1110 Date: Fri, 3 Apr 2026 14:17:11 +0900 Subject: [PATCH 2/5] Update SO_DungeonState.cs --- .../Assets/Scripts/Dungeon/SO_DungeonState.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs index 3f4ca44..b18954c 100644 --- a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs @@ -3,11 +3,11 @@ public enum DungeonState { - None, - Start, - InProgress, - Failed, - Completed, + None, // 초기 상태, 던전이 시작되지 않은 상태 + Start, // 던전이 시작된 상태 + InProgress, // 던전이 진행 중인 상태 + Failed, // 클리어에 실패한 상태 + Completed, // 클리어에 성공한 상태 } public class SO_DungeonState : ScriptableObject From 5885cd2d9df5a8d486cc8524f836903b9d98dae7 Mon Sep 17 00:00:00 2001 From: icetea1110 Date: Fri, 3 Apr 2026 14:20:53 +0900 Subject: [PATCH 3/5] Update SO_DungeonState.cs --- Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs index b18954c..1543e5f 100644 --- a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs @@ -10,6 +10,7 @@ public enum DungeonState Completed, // 클리어에 성공한 상태 } +[CreateAssetMenu(fileName = "DungeonState", menuName = "ScriptableObjects/DungeonState", order = 1)] public class SO_DungeonState : ScriptableObject { private DungeonState currentState; @@ -17,7 +18,7 @@ public class SO_DungeonState : ScriptableObject /// /// 상태 변경 시 이벤트를 발생시키는 프로퍼티 /// - public DungeonState DungeonState + public DungeonState CurrentState; { get => currentState; set From 36ebcf628b7e243c2b1d857de827281de3c79ccb Mon Sep 17 00:00:00 2001 From: icetea1110 Date: Fri, 3 Apr 2026 14:21:58 +0900 Subject: [PATCH 4/5] Update SO_DungeonState.cs --- Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs index 1543e5f..18721b7 100644 --- a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs @@ -18,7 +18,7 @@ public class SO_DungeonState : ScriptableObject /// /// 상태 변경 시 이벤트를 발생시키는 프로퍼티 /// - public DungeonState CurrentState; + public DungeonState CurrentState { get => currentState; set From ac9a31d08af9d0d442f818a7a8671e1bcee5fee4 Mon Sep 17 00:00:00 2001 From: icetea1110 Date: Fri, 3 Apr 2026 14:32:46 +0900 Subject: [PATCH 5/5] Update SO_DungeonState.cs --- Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs index 18721b7..5bbd743 100644 --- a/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs +++ b/Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs @@ -34,4 +34,9 @@ public DungeonState CurrentState /// 사용 예 : state.OnDungeonStateChanged += (newState) => { Debug.Log($"Dungeon state changed to: {newState}"); }; /// public event Action OnDungeonStateChanged; + + private void OnEnable() + { + currentState = DungeonState.None; // 초기 상태 설정 + } }