48 lines
2.0 KiB
C#
48 lines
2.0 KiB
C#
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
public class RestaurantOrderSolver : MonoBehaviour, IInteractionSolver, IInteractionSubsystemSolver<RestaurantOrderInteractionType>
|
|
{
|
|
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<RestaurantOrderInteractionType> 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<RestaurantOrderInteractionType> subsystem)
|
|
{
|
|
RestaurantOrderInteractionType interactionType = subsystem.GetInteractionSubsystemType();
|
|
// Can I solve this interaction type?
|
|
if (interactionType == RestaurantOrderInteractionType.WaitCustomer)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
} |