GameState 추가
This commit is contained in:
parent
cb90c9d288
commit
4b1aa5229a
@ -1,35 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameStateSo", menuName = "GameState/GameStateSo")]
|
||||
public class GameStateSo : ScriptableObject, IGameFlowHandler
|
||||
public class GameStateSo : ScriptableSingleton<GameStateSo>
|
||||
{
|
||||
[SerializeField] private int _level = 1;
|
||||
public GameLevelStateSo GameLevelStateSo { get; private set; }
|
||||
|
||||
public Task OnReadyNewFlow(GameFlowState newFlowState)
|
||||
private void OnEnable()
|
||||
{
|
||||
if (newFlowState is GameFlowState.None or GameFlowState.ReadyForRestaurant)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
GameLevelStateSo = CreateInstance<GameLevelStateSo>();
|
||||
}
|
||||
|
||||
public Task OnExitCurrentFlow(GameFlowState exitingFlowState)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
// TODO : 저장된 데이터 가져오기 or 없으면 데이터 초기화
|
||||
|
||||
_level = 1;
|
||||
}
|
||||
|
||||
public int GetCurrentLevel() => _level;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user