68 lines
2.2 KiB
C#
68 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
[Flags]
|
|
public enum InteractionType : uint
|
|
{
|
|
None = 0u,
|
|
RestaurantManagement = 1u << 0,
|
|
RestaurantOrder = 1u << 1,
|
|
RestaurantMeal = 1u << 2,
|
|
All = 0xFFFFFFFFu
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct InteractionExecutionParameters
|
|
{
|
|
[SerializeField] private float _holdTime;
|
|
public float HoldTime => _holdTime;
|
|
public InteractionExecutionParameters(float holdTime = 0f)
|
|
{
|
|
_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();
|
|
bool IsInteractionHidden();
|
|
bool OnInteracted(IInteractor interactor, ScriptableObject causerPayload = null);
|
|
InteractionType GetInteractionType();
|
|
GameObject GetInteractableGameObject();
|
|
void InitializeInteraction(InteractionType interactionType);
|
|
InteractionExecutionParameters GetExecutionParameters();
|
|
InteractionDisplayParameters GetDisplayParameters();
|
|
Vector3[] GetInteractionPoints();
|
|
ScriptableObject GetPayload();
|
|
}
|
|
|
|
public interface IInteractor
|
|
{
|
|
GameObject GetInteractorGameObject();
|
|
IInteractable GetFocusedInteractable();
|
|
bool CanSolveInteractionType(InteractionType interactionType);
|
|
bool CanInteractTo(IInteractable interactable,
|
|
ScriptableObject payloadSo = null);
|
|
}
|
|
|
|
public interface IInteractionSolver
|
|
{
|
|
bool ExecuteInteraction(IInteractor interactor, IInteractable interactable, ScriptableObject causerPayload = null, ScriptableObject targetPayloadSo = null);
|
|
bool CanExecuteInteraction(IInteractor interactor = null, IInteractable interactable = null, ScriptableObject causerPayload = null, ScriptableObject targetPayloadSo = null);
|
|
}
|
|
}
|