인터랙션 초기화 로직 수정 및 CustomerNpc 프리팹 업데이트

This commit is contained in:
김산 2025-08-20 15:30:08 +09:00
parent a8ff9a1707
commit 22047aeb8b
6 changed files with 52 additions and 9 deletions

View File

@ -133,7 +133,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 201f9e6d7ca7404baa9945950292a392, type: 3}
m_Name:
m_EditorClassIdentifier:
_interactionType: 4
_interactionType: 2
_executionParameters:
_holdTime: 0
_displayParameters:
@ -141,6 +141,7 @@ MonoBehaviour:
_interactionAvailableFlows: 2
_aiInteractionPoints:
- {fileID: 1664322405549350652}
autoInitialize: 1
--- !u!114 &4456475204957017828
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -1100,6 +1100,10 @@ PrefabInstance:
propertyPath: skeletonDataAsset
value:
objectReference: {fileID: 11400000, guid: 90ef4d2128c770b4cb83806c33867a79, type: 2}
- target: {fileID: 5108021082109611361, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
propertyPath: _availableInteractions
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6336425934484470474, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
propertyPath: m_Materials.Array.size
value: 4
@ -1148,6 +1152,12 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
insertIndex: -1
addedObject: {fileID: 6054843938321605399}
- targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
insertIndex: -1
addedObject: {fileID: 3924055170972325225}
- targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
insertIndex: -1
addedObject: {fileID: 3825874317044733320}
m_SourcePrefab: {fileID: 100100000, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3}
--- !u!1 &4266090516809920735 stripped
GameObject:
@ -1166,3 +1176,27 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b242c4f65b2734841840c89dfab1500b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3924055170972325225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4266090516809920735}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 784c770c13244dc0a0804056065eaf92, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3825874317044733320
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4266090516809920735}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: af69e82818254bfa9cabb2dbf9430850, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -26,8 +26,8 @@ public override TaskStatus OnUpdate()
// TODO : 아래 상호작용 수행 로직이 우리 프로젝트의 권장하는 방식이 아님. 플레이어가 오브젝트에 인터랙션하는 것과 비슷한 흐름으로 NPC가 오브젝트에 인터랙션하게 만들 것.
// 상호작용 수행: 액션이 붙은 에이전트를 Interactor로 사용
var interactor = gameObject.GetComponentInParent<IInteractor>();
if (interactor == null)
var isGetInteractor = gameObject.TryGetComponent<IInteractor>(out var interactor);
if (!isGetInteractor || !interactor.CanInteractTo(outInteractable))
{
return TaskStatus.Failure;
}

View File

@ -14,10 +14,6 @@ protected virtual void Awake()
{
_interactionComponent = GetComponent<RestaurantCharacterInteraction>();
_spineController = GetComponent<SpineController>();
}
protected virtual void Start()
{
foreach (var typeToSolver in RestaurantInteractionEventSolvers.TypeToSolver)
{
var flag = typeToSolver.Key;
@ -32,6 +28,11 @@ protected virtual void Start()
}
}
protected virtual void Start()
{
}
public GameObject GetInteractorGameObject()
{
return _interactionComponent.GetInteractorGameObject();

View File

@ -27,6 +27,7 @@ public class RestaurantInteractionComponent : MonoBehaviour, IInteractable, IInt
[SerializeField] protected GameFlowState _interactionAvailableFlows;
[SerializeField] private Transform[] _aiInteractionPoints;
[SerializeField] private bool autoInitialize = true;
private bool _isInitialized = false;
private Dictionary<InteractionType, IInteractionSubsystemObject> _subsystems = new();
@ -36,7 +37,7 @@ private void OnEnable()
var environmentState = RestaurantState.Instance?.EnvironmentState;
environmentState?.RegisterInteractable(this);
if (autoInitialize)
if (autoInitialize && !_isInitialized)
{
InitializeInteraction(_interactionType);
}
@ -53,6 +54,11 @@ private void Start()
// 보수적으로 Start에서도 등록 시도 (OnEnable 시점에 EnvironmentState가 없었을 경우 대비)
var environmentState = RestaurantState.Instance?.EnvironmentState;
environmentState?.RegisterInteractable(this);
if (autoInitialize && !_isInitialized)
{
InitializeInteraction(_interactionType);
}
}
private static IEnumerable GetAllInteractionTypes()
@ -108,6 +114,7 @@ public GameObject GetInteractableGameObject()
public virtual void InitializeInteraction(InteractionType interactionType)
{
_interactionType = interactionType;
_isInitialized = true;
InitializeSubsystems();
}

View File

@ -10,7 +10,7 @@ public abstract class RestaurantSubsystemSolver<T> : MonoBehaviour, IInteraction
protected abstract Dictionary<T, Type> GetSubsystemSolverTypeMappings();
private void Start()
private void Awake()
{
foreach (var subsystemSolverType in GetSubsystemSolverTypeMappings())
{