ProjectDDD/Assets/_DDD/_Scripts/RestaurantEvent/RestaurantOpenEventSolver.cs
2025-08-07 17:51:36 +09:00

34 lines
1.1 KiB
C#

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<RestaurantManagementSo>(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();
}
}
}