ProjectDDD/Assets/_DDD/_Scripts/GameEvent/IInteractable.cs

68 lines
2.2 KiB
C#
Raw Normal View History

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();
2025-08-26 08:27:50 +00:00
bool OnInteracted(IInteractor interactor, ScriptableObject causerPayload = null);
InteractionType GetInteractionType();
GameObject GetInteractableGameObject();
void InitializeInteraction(InteractionType interactionType);
InteractionExecutionParameters GetExecutionParameters();
InteractionDisplayParameters GetDisplayParameters();
Vector3[] GetInteractionPoints();
2025-08-26 08:27:50 +00:00
ScriptableObject GetPayload();
}
public interface IInteractor
{
GameObject GetInteractorGameObject();
IInteractable GetFocusedInteractable();
bool CanSolveInteractionType(InteractionType interactionType);
bool CanInteractTo(IInteractable interactable,
ScriptableObject payloadSo = null);
}
public interface IInteractionSolver
{
2025-08-26 08:27:50 +00:00
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);
}
}