using UnityEngine; namespace DDD { public class RestaurantOrderSolver : MonoBehaviour, IInteractionSolver, IInteractionSubsystemSolver { public bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject payloadSo = null) { return ExecuteInteractionSubsystem(interactor, interactable, payloadSo); } public bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payloadSo = null) { return CanExecuteInteractionSubsystem(interactor, interactable, payloadSo); } public bool ExecuteInteractionSubsystem(IInteractor interactor, IInteractable interactable, ScriptableObject payloadSo = null) { if (interactable is IInteractionSubsystemObject subsystem) { RestaurantOrderInteractionType interactionType = subsystem.GetInteractionSubsystemType(); // Can I solve this interaction type? if (interactionType == RestaurantOrderInteractionType.WaitCustomer) { // DO SOMETHING!!! return true; } } return false; } public bool CanExecuteInteractionSubsystem(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payloadSo = null) { if (interactable is IInteractionSubsystemObject subsystem) { RestaurantOrderInteractionType interactionType = subsystem.GetInteractionSubsystemType(); // Can I solve this interaction type? if (interactionType == RestaurantOrderInteractionType.WaitCustomer) { return true; } } return false; } } }