using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; namespace DDD { [Flags] public enum InteractionType : uint { None = 0u, RestaurantManagement = 1u << 0, RestaurantOrder = 1u << 1, RestaurantCook = 1u << 3, All = 0xFFFFFFFFu } [System.Serializable] public struct InteractionExecutionParameters { [SerializeField] private float _holdTime; public float HoldTime => _holdTime; public InteractionExecutionParameters(float holdTime = 0f) { _holdTime = holdTime; } } [System.Serializable] public struct InteractionDisplayParameters { [field: SerializeField] public string DefaultMessageKey { get; private set; } [field: SerializeField] public string ConditionalMessageKey { get; private set; } public InteractionDisplayParameters(string defaultMessageKey, string conditionalMessageKey = null) { DefaultMessageKey = defaultMessageKey ?? string.Empty; ConditionalMessageKey = conditionalMessageKey ?? DefaultMessageKey; } } public interface IInteractable { bool CanInteract(); bool IsInteractionAvailable(); void OnInteracted(IInteractor interactor, ScriptableObject causerPayload = null); InteractionType GetInteractionType(); GameObject GetInteractableGameObject(); void InitializeInteraction(InteractionType interactionType); InteractionExecutionParameters GetExecutionParameters(); InteractionDisplayParameters GetDisplayParameters(); Vector3[] GetInteractionPoints(); } public interface IInteractor { GameObject GetInteractorGameObject(); IInteractable GetFocusedInteractable(); bool CanSolveInteractionType(InteractionType interactionType); bool IsInteractionHidden(IInteractable interactable); bool CanInteractTo(IInteractable interactable, ScriptableObject payloadSo = null); } public interface IInteractionSolver { bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject payload = null); bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject payload = null); bool CanSolveInteraction(IInteractor interactor, IInteractable interactable); } }