Skip to content

Commit 459a3c4

Browse files
authored
Merge pull request #14 from Romantic-Realization-Department/feat-DungeonSystem
Feat dungeon system
2 parents d8c1174 + ac9a31d commit 459a3c4

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

Fantasy-Grower/Assets/Scripts/Dungeon.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using UnityEngine;
3+
4+
public enum DungeonState
5+
{
6+
None, // 초기 상태, 던전이 시작되지 않은 상태
7+
Start, // 던전이 시작된 상태
8+
InProgress, // 던전이 진행 중인 상태
9+
Failed, // 클리어에 실패한 상태
10+
Completed, // 클리어에 성공한 상태
11+
}
12+
13+
[CreateAssetMenu(fileName = "DungeonState", menuName = "ScriptableObjects/DungeonState", order = 1)]
14+
public class SO_DungeonState : ScriptableObject
15+
{
16+
private DungeonState currentState;
17+
18+
/// <summary>
19+
/// 상태 변경 시 이벤트를 발생시키는 프로퍼티
20+
/// </summary>
21+
public DungeonState CurrentState
22+
{
23+
get => currentState;
24+
set
25+
{
26+
if (currentState == value)
27+
return;
28+
currentState = value;
29+
OnDungeonStateChanged?.Invoke(currentState);
30+
}
31+
}
32+
33+
/// <summary>
34+
/// 사용 예 : state.OnDungeonStateChanged += (newState) => { Debug.Log($"Dungeon state changed to: {newState}"); };
35+
/// </summary>
36+
public event Action<DungeonState> OnDungeonStateChanged;
37+
38+
private void OnEnable()
39+
{
40+
currentState = DungeonState.None; // 초기 상태 설정
41+
}
42+
}

Fantasy-Grower/Assets/Scripts/Dungeon/SO_DungeonState.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)