diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs index 50f1c83ef..751a9fdfb 100644 --- a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantManagementUiEventSolver.cs @@ -6,12 +6,18 @@ public class RestaurantManagementUiEventSolver : MonoBehaviour, IInteractionSolv { public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) { - GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; - if (currentGameFlowState != GameFlowState.ReadyForRestaurant) return false; + if (CanInteract() == false) return false; + var evt = GameEvents.OpenPopupUiEvent; evt.UiType = typeof(RestaurantManagementUi); EventBus.Broadcast(evt); return true; } + + public bool CanInteract() + { + GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; + return currentGameFlowState == GameFlowState.ReadyForRestaurant; + } } } \ No newline at end of file diff --git a/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs new file mode 100644 index 000000000..68c499998 --- /dev/null +++ b/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace DDD +{ + public class RestaurantOpenEventSolver : MonoBehaviour, IInteractionSolver + { + public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) + { + if (CanInteract() == false) return false; + + GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant); + return true; + } + + public bool CanInteract() + { + GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; + return currentGameFlowState == GameFlowState.ReadyForRestaurant; + } + } +} \ No newline at end of file