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-08 06:44:11 +00:00
|
|
|
[Flags]
|
2025-08-20 05:07:33 +00:00
|
|
|
public enum InteractionType : uint
|
2025-07-17 08:55:45 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
None = 0u,
|
2025-08-20 09:55:30 +00:00
|
|
|
RestaurantManagement = 1u << 0,
|
|
|
|
RestaurantOrder = 1u << 1,
|
|
|
|
RestaurantMeal = 1u << 2,
|
2025-08-08 06:44:11 +00:00
|
|
|
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;
|
2025-08-20 09:42:07 +00:00
|
|
|
public InteractionExecutionParameters(float holdTime = 0f)
|
2025-08-20 03:59:29 +00:00
|
|
|
{
|
|
|
|
_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
|
|
|
}
|
|
|
|
}
|