Refactor: Simplify interaction target retrieval in WaitForPlayerInteraction
using TryGetComponent
and shared blackboard.
This commit is contained in:
parent
8851da71d3
commit
b4e001f03f
@ -18,17 +18,8 @@ public override void OnStart()
|
||||
{
|
||||
// 의자가 복합 상태를 가지게 될 경우
|
||||
GameObject interactionTarget = null;
|
||||
var shared = gameObject.GetComponentInChildren<IAISharedBlackboard>();
|
||||
if (shared != null)
|
||||
{
|
||||
interactionTarget = shared.GetCurrentInteractionTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 하위 호환: 고객 전용 블랙보드 지원
|
||||
var customerBb = gameObject.GetComponentInParent<IRestaurantCustomerBlackboard>();
|
||||
interactionTarget = customerBb?.GetCurrentInteractionTarget();
|
||||
}
|
||||
if(!gameObject.TryGetComponent<IAISharedBlackboard>(out var sharedBlackboard)) return;
|
||||
interactionTarget = sharedBlackboard.GetBlackboardGameObject(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget));
|
||||
|
||||
if (interactionTarget == null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user