From b4e001f03f34baab7d5bacca1a58bd5462b68c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=82=B0?= Date: Thu, 28 Aug 2025 10:49:44 +0900 Subject: [PATCH] Refactor: Simplify interaction target retrieval in `WaitForPlayerInteraction` using `TryGetComponent` and shared blackboard. --- .../AI/Customer/Actions/WaitForPlayerInteraction.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs index 8f2f3f801..6c5dd2230 100644 --- a/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs +++ b/Assets/_DDD/_Scripts/Restaurant/Character/AI/Customer/Actions/WaitForPlayerInteraction.cs @@ -18,17 +18,8 @@ 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(!gameObject.TryGetComponent(out var sharedBlackboard)) return; + interactionTarget = sharedBlackboard.GetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget)); if (interactionTarget == null) {