ProjectDDD/Assets/_DDD/_Scripts/RestaurantCharacter/AI/Customer/RestaurantCustomerBlackboardComponent.cs
2025-08-27 11:45:27 +09:00

40 lines
1.4 KiB
C#

using Opsive.BehaviorDesigner.Runtime;
using UnityEngine;
namespace DDD
{
public class RestaurantCustomerBlackboardComponent : MonoBehaviour, IRestaurantCustomerBlackboard, IAISharedBlackboard
{
private Subtree _subtree;
private GameObject _currentInteractionTarget;
public void InitializeWithBehaviorTree(Subtree subtree)
{
_subtree = subtree;
if (_subtree != null)
{
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject);
}
}
public void SetCustomerData(CustomerData inCustomerData)
{
if (_subtree == null) return;
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData);
}
public void SetCurrentInteractionTarget(GameObject targetGameObject)
{
_currentInteractionTarget = targetGameObject;
if (_subtree == null) return;
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CurrentInteractionTarget), targetGameObject);
}
public GameObject GetCurrentInteractionTarget()
{
// 캐시 우선 반환. 필요 시 Subtree에서 직접 조회하도록 확장 가능.
return _currentInteractionTarget;
}
}
}