Behavior Designer扩展
Posted Hichy
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Behavior Designer扩展相关的知识,希望对你有一定的参考价值。
BehaviorManager.instance.Tick(behaviorTree); 卸载update里u3d直接卡死 = =
SharedVariable直接赋值会改变他的引用关系,必须用XXX.Value赋值 = =
两种自定义Task: Task 和 Parent Tasks
基础task流程 ( Conditional Task 和 Action Task )
![](https://image.cha138.com/20210609/5fff5915357c4effb6c6f0611e53734c.jpg)
Parent Tasks
// The maximum number of children a parent task can have. Will usually be 1 or int.MaxValue
public virtual int MaxChildren();
// Boolean value to determine if the current task is a parallel task
public virtual bool CanRunParallelChildren();
// The index of the currently active child
public virtual int CurrentChildIndex();
// Boolean value to determine if the current task can execute
public virtual bool CanExecute();
// Apply a decorator to the executed status
public virtual TaskStatus Decorate(TaskStatus status);
// Notifies the parent task that the child has been executed and has a status of childStatus
public virtual void OnChildExecuted(TaskStatus childStatus);
// Notifies the parent task that the child at index childIndex has been executed and has a status of childStatus
public virtual void OnChildExecuted(int childIndex, TaskStatus childStatus);
// Notifies the task that the child has started to run
public virtual void OnChildStarted();
// Notifies the parallel task that the child at index childIndex has started to run
public virtual void OnChildStarted(int childIndex);
// Some parent tasks need to be able to override the status, such as parallel tasks
public virtual TaskStatus OverrideStatus(TaskStatus status);
// The interrupt node will override the status if it has been interrupted.
public virtual TaskStatus OverrideStatus();
// Notifies the composite task that an conditional abort has been triggered and the child index should reset
public virtual void OnConditionalAbort(int childIndex);
父节点基础类ParentTask派生出装饰节点Decorator
// The maximum number of children a parent task can have. Will usually be 1 or int.MaxValue
public virtual int MaxChildren();
// Boolean value to determine if the current task is a parallel task
public virtual bool CanRunParallelChildren();
// The index of the currently active child
public virtual int CurrentChildIndex();
// Boolean value to determine if the current task can execute
public virtual bool CanExecute();
// Apply a decorator to the executed status
public virtual TaskStatus Decorate(TaskStatus status);
// Notifies the parent task that the child has been executed and has a status of childStatus
public virtual void OnChildExecuted(TaskStatus childStatus);
// Notifies the parent task that the child at index childIndex has been executed and has a status of childStatus
public virtual void OnChildExecuted(int childIndex, TaskStatus childStatus);
// Notifies the task that the child has started to run
public virtual void OnChildStarted();
// Notifies the parallel task that the child at index childIndex has started to run
public virtual void OnChildStarted(int childIndex);
// Some parent tasks need to be able to override the status, such as parallel tasks
public virtual TaskStatus OverrideStatus(TaskStatus status);
// The interrupt node will override the status if it has been interrupted.
public virtual TaskStatus OverrideStatus();
// Notifies the composite task that an conditional abort has been triggered and the child index should reset
public virtual void OnConditionalAbort(int childIndex);
以上是关于Behavior Designer扩展的主要内容,如果未能解决你的问题,请参考以下文章
基于行为树的AI 与 Behavior Designer插件
Unity3D Behavior Designer 行为树4 打断机制的实现
Unity3D Behavior Designer 行为树3 不能被Disable的BehaviorManager及其神秘的TaskExecutionType