From bfcc99be3843531e373c4d6ce0635290f8434a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Wed, 27 Aug 2025 11:45:27 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Addressables/Prefabs/CustomerNpc.prefab | 23 ------ .../Common/Actions/MoveToInteractionTarget.cs | 3 +- .../AI/Common/Decorator/TimeLimiter.cs | 2 +- .../Customer/Actions/StartRestaurantOrder.cs | 1 + .../Actions/WaitForPlayerInteraction.cs | 70 ++++++------------- .../RestaurantCustomerBlackboardComponent.cs | 1 + .../RestaurantMealInteractionSubsystem.cs | 4 ++ 7 files changed, 30 insertions(+), 74 deletions(-) diff --git a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab index 80cdc789c..d16acedec 100644 --- a/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab +++ b/Assets/_DDD/_Addressables/Prefabs/CustomerNpc.prefab @@ -1210,9 +1210,6 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} insertIndex: -1 addedObject: {fileID: 3825874317044733320} - - targetCorrespondingSourceObject: {fileID: 7462519206451630147, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} - insertIndex: -1 - addedObject: {fileID: 1122074513716966771} m_SourcePrefab: {fileID: 100100000, guid: ceeea618d8ee23642a0e56b3f963448c, type: 3} --- !u!1 &4266090516809920735 stripped GameObject: @@ -1255,23 +1252,3 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: af69e82818254bfa9cabb2dbf9430850, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1122074513716966771 -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: 201f9e6d7ca7404baa9945950292a392, type: 3} - m_Name: - m_EditorClassIdentifier: - _interactionType: 4 - _executionParameters: - _holdTime: 0 - _displayParameters: - _messageKey: - _interactionAvailableFlows: 2 - _aiInteractionPoints: [] - autoInitialize: 1 diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Actions/MoveToInteractionTarget.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Actions/MoveToInteractionTarget.cs index 828782504..4e284809c 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Actions/MoveToInteractionTarget.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Actions/MoveToInteractionTarget.cs @@ -1,5 +1,6 @@ using Opsive.BehaviorDesigner.Runtime.Tasks; using Opsive.BehaviorDesigner.Runtime.Tasks.Actions; +using Opsive.BehaviorDesigner.Runtime.Tasks.Events; using UnityEngine; namespace DDD @@ -29,6 +30,7 @@ public class MoveToInteractionTarget : Action public override void OnStart() { + Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] OnStart"); if (cachedTarget != null) return; movement = gameObject.GetComponentInParent(); repathTimer = 0f; @@ -44,7 +46,6 @@ public override TaskStatus OnUpdate() var target = GetTarget(); if (target == null) return failIfNoTarget ? TaskStatus.Failure : TaskStatus.Success; - Debug.Log(target.name); if (ShouldUpdateDestination()) { diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Decorator/TimeLimiter.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Decorator/TimeLimiter.cs index ec725c587..15c13cd29 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Decorator/TimeLimiter.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Common/Decorator/TimeLimiter.cs @@ -188,7 +188,7 @@ public void Execute(ref DynamicBuffer branchComponents, branchComponents[taskComponent.BranchIndex] = branchComponent; continue; } - else if (taskComponent.Status != TaskStatus.Running) + if (taskComponent.Status != TaskStatus.Running) { continue; } diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/StartRestaurantOrder.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/StartRestaurantOrder.cs index 7fa600a90..f0997393f 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/StartRestaurantOrder.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/StartRestaurantOrder.cs @@ -19,6 +19,7 @@ public class StartRestaurantOrder : Action public override void OnStart() { _isGetInteractor = gameObject.TryGetComponent(out _interactor); + if (!_isGetInteractor) Debug.LogError($"[{GetType().Name}] IInteractor를 찾을 수 없습니다: {gameObject.name}"); } diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/WaitForPlayerInteraction.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/WaitForPlayerInteraction.cs index 220788be6..ec90190a9 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/WaitForPlayerInteraction.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/Actions/WaitForPlayerInteraction.cs @@ -17,55 +17,27 @@ public class WaitForPlayerInteraction : Action public override void OnStart() { // 의자가 복합 상태를 가지게 될 경우 - // GameObject interactionTarget = null; - // var shared = gameObject.GetComponentInChildren(); - // if (shared != null) - // { - // interactionTarget = shared.GetCurrentInteractionTarget(); - // } - // else - // { - // // 하위 호환: 고객 전용 블랙보드 지원 - // var customerBb = gameObject.GetComponentInParent(); - // interactionTarget = customerBb?.GetCurrentInteractionTarget(); - // } - // - // if (interactionTarget == null) - // { - // Debug.LogError($"[{GetType().Name}] interactionTarget을 찾을 수 없습니다: {gameObject.name}"); - // return; - // } - // - // if (!interactionTarget.TryGetComponent(out var interactionComponent)) - // Debug.LogError($"[{interactionTarget.name}] {nameof(interactionComponent)}를 찾을 수 없습니다: {gameObject.name}"); - // if (interactionComponent is IInteractionSubsystemOwner subsystemOwner) - // { - // if (!subsystemOwner.TryGetSubsystemObject(out var subsystem)) - // { - // Debug.LogError($"[{GetType().Name}] {nameof(_targetOrderType)}의 Subsystem을 찾을 수 없습니다: {gameObject.name}"); - // _isGetInteractionSubsystem = false; - // return; - // } - // - // _isGetInteractionSubsystem = true; - // subsystem.SetInteractionSubsystemType(_targetOrderType); - // - // if (!gameObject.TryGetComponent(out var interactor)) - // { - // Debug.LogError($"[{GetType().Name}] IInteractor를 찾을 수 없습니다: {gameObject.name}"); - // return; - // } - // - // interactor.CanInteractTo(interactionComponent); - // - // _interactionSubsystem = subsystem; - // } - - if (!gameObject.TryGetComponent(out var interactionComponent)) - { - Debug.LogError($"[{GetType().Name}]에서 interactionComponent를 찾을 수 없습니다: {gameObject.name}"); - return; - } + GameObject interactionTarget = null; + var shared = gameObject.GetComponentInChildren(); + if (shared != null) + { + interactionTarget = shared.GetCurrentInteractionTarget(); + } + else + { + // 하위 호환: 고객 전용 블랙보드 지원 + var customerBb = gameObject.GetComponentInParent(); + interactionTarget = customerBb?.GetCurrentInteractionTarget(); + } + + if (interactionTarget == null) + { + Debug.LogError($"[{GetType().Name}] interactionTarget을 찾을 수 없습니다: {gameObject.name}"); + return; + } + + if (!interactionTarget.TryGetComponent(out var interactionComponent)) + Debug.LogError($"[{interactionTarget.name}] {nameof(interactionComponent)}를 찾을 수 없습니다: {gameObject.name}"); if (interactionComponent is not IInteractionSubsystemOwner subsystemOwner) { diff --git a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/RestaurantCustomerBlackboardComponent.cs b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/RestaurantCustomerBlackboardComponent.cs index 98112000e..efef15e5b 100644 --- a/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/RestaurantCustomerBlackboardComponent.cs +++ b/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/RestaurantCustomerBlackboardComponent.cs @@ -28,6 +28,7 @@ public void SetCurrentInteractionTarget(GameObject targetGameObject) _currentInteractionTarget = targetGameObject; if (_subtree == null) return; _subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), targetGameObject); + } public GameObject GetCurrentInteractionTarget() diff --git a/Assets/_DDD/_Scripts/RestaurantEnvironment/Interactions/RestaurantMealInteractionSubsystem.cs b/Assets/_DDD/_Scripts/RestaurantEnvironment/Interactions/RestaurantMealInteractionSubsystem.cs index d018dc86b..ffaceb0d6 100644 --- a/Assets/_DDD/_Scripts/RestaurantEnvironment/Interactions/RestaurantMealInteractionSubsystem.cs +++ b/Assets/_DDD/_Scripts/RestaurantEnvironment/Interactions/RestaurantMealInteractionSubsystem.cs @@ -1,4 +1,5 @@ using System; +using Unity.VisualScripting; using UnityEngine; namespace DDD @@ -23,11 +24,13 @@ public RestaurantMealType GetInteractionSubsystemType() public void SetInteractionSubsystemType(RestaurantMealType inValue) { + Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] SetInteractionSubsystemType {inValue.ToString()}"); _currentRestaurantMealType = inValue; } public void InitializeSubsystem() { + Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] InitializeSubsystem"); _currentRestaurantMealType = RestaurantMealType.None; } @@ -38,6 +41,7 @@ public bool CanInteract() public bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null) { + Debug.Log($"[{gameObject.GetHashCode()}, {GetType().Name}] OnInteracted"); var prev = _currentRestaurantMealType; _currentRestaurantMealType = GetNextState(prev); return true;