2025-08-08 06:44:11 +00:00
|
|
|
using System;
|
2025-08-14 04:46:36 +00:00
|
|
|
using System.Collections.Generic;
|
2025-07-17 08:55:45 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace DDD
|
|
|
|
{
|
2025-08-20 03:59:29 +00:00
|
|
|
/* TODO : BitFlag 제거해야할듯.
|
|
|
|
인터랙션 개수가 엄청나게 많아질것으로 예상됨.
|
|
|
|
혹은 인터랙션 타입을 여기서 추가하면 안 되고 여기는 몇가지 정적인 타입만 두고 RestaurantInteraction 같은 식으로 확장해서 사용해야함.
|
|
|
|
확장성을 생각하면 RestaurantInteractionSolver에서 RestaurantInteractionType을 리졸브해서 또 다른 Solver로 포워딩하는 식으로.
|
|
|
|
편하게 하려면 그냥 여기서 비트연산자 없애고 인터랙션타입을 무한정 늘리기.
|
|
|
|
*/
|
2025-08-08 06:44:11 +00:00
|
|
|
[Flags]
|
2025-08-20 03:59:29 +00:00
|
|
|
public enum InteractionType : ulong
|
2025-07-17 08:55:45 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
None = 0u,
|
|
|
|
RestaurantManagementUi = 1u << 0,
|
|
|
|
OpenRestaurant = 1u << 1,
|
|
|
|
All = 0xFFFFFFFFu
|
2025-07-17 08:55:45 +00:00
|
|
|
}
|
2025-08-20 03:59:29 +00:00
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public struct InteractionExecutionParameters
|
|
|
|
{
|
|
|
|
[SerializeField] private float _holdTime;
|
|
|
|
public float HoldTime => _holdTime;
|
|
|
|
public InteractionExecutionParameters(float holdTime = 1f)
|
|
|
|
{
|
|
|
|
_holdTime = holdTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public struct InteractionDisplayParameters
|
|
|
|
{
|
|
|
|
[SerializeField] private string _messageKey;
|
|
|
|
public string MessageKey => _messageKey;
|
|
|
|
public InteractionDisplayParameters(string messageKey = "")
|
|
|
|
{
|
|
|
|
_messageKey = messageKey;
|
|
|
|
}
|
|
|
|
}
|
2025-08-08 06:44:11 +00:00
|
|
|
|
2025-07-17 08:55:45 +00:00
|
|
|
public interface IInteractable
|
|
|
|
{
|
|
|
|
bool CanInteract();
|
2025-08-14 05:30:14 +00:00
|
|
|
bool IsInteractionHidden();
|
2025-08-14 04:46:36 +00:00
|
|
|
bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null);
|
2025-07-22 11:15:20 +00:00
|
|
|
InteractionType GetInteractionType();
|
|
|
|
GameObject GetInteractableGameObject();
|
|
|
|
void InitializeInteraction(InteractionType interactionType);
|
2025-08-20 03:59:29 +00:00
|
|
|
InteractionExecutionParameters GetExecutionParameters();
|
|
|
|
InteractionDisplayParameters GetDisplayParameters();
|
2025-08-19 11:13:29 +00:00
|
|
|
Vector3[] GetInteractionPoints();
|
2025-07-17 08:55:45 +00:00
|
|
|
}
|
2025-08-14 04:46:36 +00:00
|
|
|
|
2025-07-17 08:55:45 +00:00
|
|
|
public interface IInteractor
|
|
|
|
{
|
2025-07-22 11:15:20 +00:00
|
|
|
GameObject GetInteractorGameObject();
|
2025-08-14 04:46:36 +00:00
|
|
|
IInteractable GetFocusedInteractable();
|
|
|
|
bool CanSolveInteractionType(InteractionType interactionType);
|
|
|
|
bool CanInteractTo(IInteractable interactable,
|
|
|
|
ScriptableObject payloadSo = null);
|
2025-07-22 11:15:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public interface IInteractionSolver
|
|
|
|
{
|
2025-08-14 04:46:36 +00:00
|
|
|
bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject payloadSo = null);
|
|
|
|
bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null,
|
|
|
|
ScriptableObject payloadSo = null);
|
2025-07-17 08:55:45 +00:00
|
|
|
}
|
|
|
|
}
|