커스터머 AI 블랙보드 세팅

This commit is contained in:
Jeonghyeon Ha 2025-08-28 10:49:29 +09:00
parent dfc4fa26d6
commit d2f33de6ab
3 changed files with 15 additions and 14 deletions

Binary file not shown.

View File

@ -47,7 +47,7 @@ private async Task InitializeAiInternal(CustomerData inCustomerData)
} }
_behaviorTree.Subgraph = subtree; _behaviorTree.Subgraph = subtree;
_blackboardComponent.InitializeWithBehaviorTree(subtree); _blackboardComponent.InitializeWithBehaviorTree(_behaviorTree);
_blackboardComponent.SetCustomerData(inCustomerData); _blackboardComponent.SetCustomerData(inCustomerData);
// TODO : 1. Subtree - Action, Condition // TODO : 1. Subtree - Action, Condition
// TODO : 2. Blackboard // TODO : 2. Blackboard

View File

@ -5,33 +5,34 @@ namespace DDD
{ {
public class CustomerBlackboardComponent : MonoBehaviour, ICustomerBlackboard, IAISharedBlackboard public class CustomerBlackboardComponent : MonoBehaviour, ICustomerBlackboard, IAISharedBlackboard
{ {
private Subtree _subtree; // private Subtree _behaviorTree;
private BehaviorTree _behaviorTree;
public void InitializeWithBehaviorTree(Subtree subtree) public void InitializeWithBehaviorTree(BehaviorTree inBehaviorTree)
{ {
_subtree = subtree; _behaviorTree = inBehaviorTree;
if (_subtree != null) if (_behaviorTree)
{ {
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject); _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject);
} }
} }
public void SetCustomerData(CustomerData inCustomerData) public void SetCustomerData(CustomerData inCustomerData)
{ {
if (_subtree == null) return; if (!_behaviorTree) return;
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData); _behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData);
} }
public void SetBlackboardGameObject(string key, GameObject inGameObject) public void SetBlackboardGameObject(string key, GameObject inGameObject)
{ {
if (_subtree == null) return; if (_behaviorTree == null) return;
_subtree.SetVariableValue(key, inGameObject); _behaviorTree.SetVariableValue(key, inGameObject);
} }
public GameObject GetBlackboardGameObject(string key) public GameObject GetBlackboardGameObject(string key)
{ {
if (_subtree == null) return null; if (_behaviorTree == null) return null;
return _subtree.GetVariable<GameObject>(key)?.Value; return _behaviorTree.GetVariable<GameObject>(key)?.Value;
} }
} }
} }