RestaurantRunController 오류 수정

This commit is contained in:
NTG 2025-08-18 14:09:56 +09:00
parent cb2970b897
commit 96aa756769
7 changed files with 26 additions and 35 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 6a8ae0a4b68a9b94889b9889b63ebacd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -13,8 +13,8 @@ public enum GameFlowState : uint
RunRestaurant = 1u << 1,
SettlementRestaurant = 1u << 2,
All = 0xFFFFFFFFu
}
}
public class GameFlowManager : Singleton<GameFlowManager>, IManager
{
public GameFlowDataSo GameFlowDataSo;
@ -28,32 +28,32 @@ public void PreInit()
public Task Init()
{
return Task.CompletedTask;;
return Task.CompletedTask; ;
}
public void PostInit()
public async void PostInit()
{
if (IsGameStarted() == false)
{
ChangeFlow(GameFlowState.ReadyForRestaurant);
await ChangeFlow(GameFlowState.ReadyForRestaurant);
}
}
private bool IsGameStarted() => GameFlowDataSo.CurrentGameState != GameFlowState.None;
public void ChangeFlow(GameFlowState newFlowState)
public async Task ChangeFlow(GameFlowState newFlowState)
{
if (!CanChangeFlow(newFlowState))
if (CanChangeFlow(newFlowState) == false)
{
Debug.LogError("Can't change flow");
return;
}
_ = EndCurrentFlow();
_ = ReadyNewFlow(newFlowState);
await EndCurrentFlow();
await ReadyNewFlow(newFlowState);
}
private bool CanChangeFlow(GameFlowState newFlowState)
{
return true;
@ -62,27 +62,27 @@ private bool CanChangeFlow(GameFlowState newFlowState)
private async Task EndCurrentFlow()
{
var endCurrentFlowState = GameFlowDataSo.CurrentGameState;
foreach (var handler in FlowHandlers)
{
await handler.OnExitCurrentFlow(endCurrentFlowState);
}
}
private async Task ReadyNewFlow(GameFlowState newFlowState)
{
GameFlowDataSo.CurrentGameState = newFlowState;
await OpenFlowScene(newFlowState);
foreach (var handler in FlowHandlers)
{
await handler.OnReadyNewFlow(newFlowState);
}
await OpenFlowScene(newFlowState);
StartFlow();
}
private async Task OpenFlowScene(GameFlowState newFlowState)
{
if (GetFlowScene(newFlowState))
@ -102,7 +102,7 @@ private bool GetFlowScene(GameFlowState flowState)
private void StartFlow()
{
}
}
}

View File

@ -8,8 +8,8 @@ public class RestaurantRunController : FlowController
RestaurantCustomerStateSo _restaurantCustomerStateSo;
public override Task InitializeController()
{
return Task.CompletedTask;
_restaurantCustomerStateSo = RestaurantState.instance.CustomerState;
return Task.CompletedTask;
}
public override Task InitializeState()

View File

@ -9,6 +9,7 @@ public class RestaurantState : ScriptableSingleton<RestaurantState>
public RestaurantRunStateSo RunState { get; private set; }
public RestaurantEnvironmentStateSo EnvironmentState { get; private set; }
public RestaurantPlayerStateSo PlayerState { get; private set; }
public RestaurantCustomerStateSo CustomerState { get; private set; }
// TODO : Load from disk(SaveData)
private void OnEnable()
@ -17,6 +18,7 @@ private void OnEnable()
RunState = CreateInstance<RestaurantRunStateSo>();
EnvironmentState = CreateInstance<RestaurantEnvironmentStateSo>();
PlayerState = CreateInstance<RestaurantPlayerStateSo>();
CustomerState = CreateInstance<RestaurantCustomerStateSo>();
}
}
}