using System.Threading.Tasks; using UnityEngine; namespace DDD { public class RestaurantOpenEventSolver : MonoBehaviour, IInteractionSolver { private RestaurantManagementSo _restaurantManagementSo; private void Start() { _ = Initialize(); } private async Task Initialize() { _restaurantManagementSo = await AssetManager.LoadAsset(DataConstants.RestaurantManagementSo); } public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject interactionPayloadSo = null) { if (CanExecuteInteraction() == false) return false; GameFlowManager.Instance.ChangeFlow(GameFlowState.RunRestaurant); return true; } public bool CanExecuteInteraction() { GameFlowState currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; return currentGameFlowState == GameFlowState.ReadyForRestaurant && _restaurantManagementSo.IsOpenable(); } } }