인터랙션 파라미터 구조체 작성

InteractionExecutionParameters, InteractionDisplayParamaters
This commit is contained in:
Jeonghyeon Ha 2025-08-20 12:59:29 +09:00
parent b57c959b89
commit e0e0f3564f
2 changed files with 49 additions and 12 deletions

View File

@ -4,14 +4,42 @@
namespace DDD
{
/* TODO : BitFlag .
.
RestaurantInteraction .
RestaurantInteractionSolver에서 RestaurantInteractionType을 Solver로 .
.
*/
[Flags]
public enum InteractionType : uint
public enum InteractionType : ulong
{
None = 0u,
RestaurantManagementUi = 1u << 0,
OpenRestaurant = 1u << 1,
All = 0xFFFFFFFFu
}
[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;
}
}
public interface IInteractable
{
@ -21,10 +49,8 @@ public interface IInteractable
InteractionType GetInteractionType();
GameObject GetInteractableGameObject();
void InitializeInteraction(InteractionType interactionType);
// TODO : Struct InteractionExecutionParameters 등으로 정리
float GetRequiredHoldTime();
// TODO : Struct InteractionDisplayParameters 등으로 정리
string GetInteractionMessageKey();
InteractionExecutionParameters GetExecutionParameters();
InteractionDisplayParameters GetDisplayParameters();
Vector3[] GetInteractionPoints();
}

View File

@ -2,12 +2,12 @@
namespace DDD
{
public class RestaurantInteractionComponent : MonoBehaviour, IInteractable
{
[SerializeField] private InteractionType _interactionType = InteractionType.None;
[SerializeField] private float _holdTime = 1f;
[SerializeField] private string _interactionMessageKey = "";
[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;
@ -49,21 +49,32 @@ public void InitializeInteraction(InteractionType interactionType)
_interactionType = interactionType;
}
// 새로운 스트럭트 기반 메서드들
public InteractionExecutionParameters GetExecutionParameters()
{
return _executionParameters;
}
public InteractionDisplayParameters GetDisplayParameters()
{
return _displayParameters;
}
// 하위 호환성을 위한 기존 메서드들
public float GetRequiredHoldTime()
{
return _holdTime;
return _executionParameters.HoldTime;
}
public string GetInteractionMessageKey()
{
return _interactionMessageKey;
return _displayParameters.MessageKey;
}
public Vector3[] GetInteractionPoints()
{
if (_aiInteractionPoints == null || _aiInteractionPoints.Length == 0)
{
// AI 상호작용 포인트가 설정되지 않은 경우 오브젝트의 위치를 기본값으로 반환
return new Vector3[] { transform.position };
}