using Sirenix.OdinInspector; using UnityEngine; namespace DDD { public class RestaurantCharacter : MonoBehaviour, IGameCharacter, IInteractor { [EnumToggleButtons, SerializeField] protected InteractionType _interactionType; RestaurantCharacterInteraction _interactionComponent; protected virtual void Awake() { _interactionComponent = GetComponent(); } 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); } } }