ProjectDDD/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs

52 lines
1.6 KiB
C#
Raw Normal View History

using Sirenix.OdinInspector;
2025-07-09 09:45:11 +00:00
using UnityEngine;
namespace DDD
{
public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor
2025-07-09 09:45:11 +00:00
{
[EnumToggleButtons, SerializeField] protected InteractionType _interactionType;
2025-08-12 11:46:30 +00:00
RestaurantCharacterInteraction _interactionComponent;
protected virtual void Awake()
{
_interactionComponent = GetComponent<RestaurantCharacterInteraction>();
}
2025-08-12 11:46:30 +00:00
protected virtual void Start()
{
foreach (var typeToSolver in RestaurantInteractionEventSolvers.TypeToSolver)
{
var flag = typeToSolver.Key;
if (flag == InteractionType.None) continue;
if ((_interactionType & flag) == 0) continue;
if (!TryGetComponent(typeToSolver.Value, out _))
{
gameObject.AddComponent(typeToSolver.Value);
}
}
}
public GameObject GetInteractorGameObject()
{
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-09 09:45:11 +00:00
}
}