Merge remote-tracking branch 'origin/feature/customer_moveto' into feature/customer_moveto/FixToBlackboard
This commit is contained in:
commit
60205d3c00
BIN
Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset
(Stored with Git LFS)
BIN
Assets/_DDD/_Addressables/AI/Customer/Subtree/CustomerDefault.asset
(Stored with Git LFS)
Binary file not shown.
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user