ProjectDDD/Assets/_DDD/_Scripts/RestaurantCharacter/RestaurantCharacter.cs
Jeonghyeon Ha 0fe8a54e09 레스토랑 캐릭터 시스템 컴포넌트 의존성 개선
- RestaurantCharacter, RestaurantNpcCharacter, RestaurantCharacterAnimation에 RequireComponent 어트리뷰트 추가
- RestaurantCharacterMovementConstraint에 필수 컴포넌트 의존성 명시
- 깃 커밋 가이드라인 추가
2025-08-19 17:01:38 +09:00

57 lines
1.8 KiB
C#

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