using UnityEngine; namespace DDD { public class RestaurantInteractionComponent : MonoBehaviour, IInteractable { [SerializeField] protected InteractionType _interactionType = InteractionType.None; [SerializeField] protected InteractionExecutionParameters _executionParameters = new InteractionExecutionParameters(1f); [SerializeField] protected InteractionDisplayParameters _displayParameters = new InteractionDisplayParameters(""); [SerializeField] protected GameFlowState _interactionAvailableFlows; [SerializeField] private Transform[] _aiInteractionPoints; public bool CanInteract() { return !IsInteractionHidden(); } public bool IsInteractionHidden() { var currentGameFlowState = GameFlowManager.Instance.GameFlowDataSo.CurrentGameState; var flowDisabled = (currentGameFlowState & _interactionAvailableFlows) == 0; return flowDisabled; } public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null) { if (CanInteract() == false) { return false; } bool interactionResult = RestaurantInteractionEvents.RestaurantInteraction.RequestInteraction(interactor.GetInteractorGameObject(), GetInteractableGameObject(), GetInteractionType(), payloadSo, true); return interactionResult; } public InteractionType GetInteractionType() { return _interactionType; } public GameObject GetInteractableGameObject() { return gameObject; } public void InitializeInteraction(InteractionType interactionType) { _interactionType = interactionType; } // 새로운 스트럭트 기반 메서드들 public InteractionExecutionParameters GetExecutionParameters() { return _executionParameters; } public InteractionDisplayParameters GetDisplayParameters() { return _displayParameters; } // 하위 호환성을 위한 기존 메서드들 public float GetRequiredHoldTime() { return _executionParameters.HoldTime; } public string GetInteractionMessageKey() { return _displayParameters.MessageKey; } public Vector3[] GetInteractionPoints() { if (_aiInteractionPoints == null || _aiInteractionPoints.Length == 0) { return new Vector3[] { transform.position }; } Vector3[] positions = new Vector3[_aiInteractionPoints.Length]; for (int i = 0; i < _aiInteractionPoints.Length; i++) { if (_aiInteractionPoints[i] != null) { positions[i] = _aiInteractionPoints[i].position; } else { positions[i] = transform.position; } } return positions; } } }