2025-08-08 06:44:11 +00:00
|
|
|
using Sirenix.OdinInspector;
|
2025-07-09 09:45:11 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace DDD
|
|
|
|
{
|
2025-07-22 11:15:20 +00:00
|
|
|
public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor
|
2025-07-09 09:45:11 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
[EnumToggleButtons, SerializeField] protected InteractionType _interactionType;
|
2025-08-12 11:46:30 +00:00
|
|
|
|
2025-08-14 04:46:36 +00:00
|
|
|
RestaurantCharacterInteraction _interactionComponent;
|
|
|
|
protected virtual void Awake()
|
|
|
|
{
|
|
|
|
_interactionComponent = GetComponent<RestaurantCharacterInteraction>();
|
|
|
|
}
|
2025-08-12 11:46:30 +00:00
|
|
|
|
|
|
|
protected virtual void Start()
|
2025-07-22 11:15:20 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
foreach (var typeToSolver in RestaurantInteractionEventSolvers.TypeToSolver)
|
2025-07-22 11:15:20 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
var flag = typeToSolver.Key;
|
|
|
|
if (flag == InteractionType.None) continue;
|
|
|
|
|
|
|
|
if ((_interactionType & flag) == 0) continue;
|
|
|
|
|
|
|
|
if (!TryGetComponent(typeToSolver.Value, out _))
|
2025-07-22 11:15:20 +00:00
|
|
|
{
|
2025-08-08 06:44:11 +00:00
|
|
|
gameObject.AddComponent(typeToSolver.Value);
|
2025-07-22 11:15:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public GameObject GetInteractorGameObject()
|
|
|
|
{
|
2025-08-14 04:46:36 +00:00
|
|
|
return _interactionComponent.GetInteractorGameObject();
|
|
|
|
}
|
|
|
|
|
|
|
|
public IInteractable GetFocusedInteractable()
|
|
|
|
{
|
|
|
|
return _interactionComponent.GetFocusedInteractable();
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool CanSolveInteractionType(InteractionType interactionType)
|
|
|
|
{
|
|
|
|
return _interactionComponent.CanSolveInteractionType(interactionType);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool CanInteractTo(IInteractable interactable, ScriptableObject payloadSo = null)
|
|
|
|
{
|
|
|
|
return _interactionComponent.CanInteractTo(interactable, payloadSo);
|
2025-07-22 11:15:20 +00:00
|
|
|
}
|
2025-07-09 09:45:11 +00:00
|
|
|
}
|
|
|
|
}
|