Merge remote-tracking branch 'origin/feature/customer_moveto' into feature/customer_moveto/FixToBlackboard

This commit is contained in:
김산 2025-08-28 10:51:37 +09:00
commit 60205d3c00
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;
_blackboardComponent.InitializeWithBehaviorTree(subtree);
_blackboardComponent.InitializeWithBehaviorTree(_behaviorTree);
_blackboardComponent.SetCustomerData(inCustomerData);
// TODO : 1. Subtree - Action, Condition
// TODO : 2. Blackboard

View File

@ -5,33 +5,34 @@ namespace DDD
{
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;
if (_subtree != null)
_behaviorTree = inBehaviorTree;
if (_behaviorTree)
{
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject);
_behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.SelfGameObject), gameObject);
}
}
public void SetCustomerData(CustomerData inCustomerData)
{
if (_subtree == null) return;
_subtree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData);
if (!_behaviorTree) return;
_behaviorTree.SetVariableValue(nameof(RestaurantCustomerBlackboardKey.CustomerData), inCustomerData);
}
public void SetBlackboardGameObject(string key, GameObject inGameObject)
{
if (_subtree == null) return;
_subtree.SetVariableValue(key, inGameObject);
if (_behaviorTree == null) return;
_behaviorTree.SetVariableValue(key, inGameObject);
}
public GameObject GetBlackboardGameObject(string key)
{
if (_subtree == null) return null;
return _subtree.GetVariable<GameObject>(key)?.Value;
if (_behaviorTree == null) return null;
return _behaviorTree.GetVariable<GameObject>(key)?.Value;
}
}
}