인터랙션 파라미터 구조체 작성
InteractionExecutionParameters, InteractionDisplayParamaters
This commit is contained in:
parent
b57c959b89
commit
e0e0f3564f
@ -4,8 +4,14 @@
|
||||
|
||||
namespace DDD
|
||||
{
|
||||
/* TODO : BitFlag 제거해야할듯.
|
||||
인터랙션 개수가 엄청나게 많아질것으로 예상됨.
|
||||
혹은 인터랙션 타입을 여기서 추가하면 안 되고 여기는 몇가지 정적인 타입만 두고 RestaurantInteraction 같은 식으로 확장해서 사용해야함.
|
||||
확장성을 생각하면 RestaurantInteractionSolver에서 RestaurantInteractionType을 리졸브해서 또 다른 Solver로 포워딩하는 식으로.
|
||||
편하게 하려면 그냥 여기서 비트연산자 없애고 인터랙션타입을 무한정 늘리기.
|
||||
*/
|
||||
[Flags]
|
||||
public enum InteractionType : uint
|
||||
public enum InteractionType : ulong
|
||||
{
|
||||
None = 0u,
|
||||
RestaurantManagementUi = 1u << 0,
|
||||
@ -13,6 +19,28 @@ public enum InteractionType : uint
|
||||
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
|
||||
{
|
||||
bool CanInteract();
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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 };
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user