[Unity插件]Behavior Designer
2016-01-22 22:58
671 查看
给物体添加Behavior Tree组件,点击Open Behavior Designer进行行为树的编辑。
1.编辑器
第1-5个按钮用于选择要编辑的行为树
Referenced Behaviors可以查看当前行为树引用的行为树(可以通过Actions节点下的Behavior Tree Reference引用行为树)
- :删除当前行为树
+ :为当前物体添加一个新的行为树组件
Lock :锁定当前行为树,即使选择其他的游戏物体也不会改变当前的视图
2.生命周期
3.常用API
4.
a.如何停止AI
直接将BehaviorTree组件禁用掉并不能停止AI。先要将预制的BehaviorTree组件禁用掉,然后将PauseWhenDisable勾选。此时通过脚本enabled行为树即可自由控制行为树的开启和关闭了。
b.如何引用另一棵行为树
在行为树编辑界面上,右键Save XXX,即可将当前行为树保存为一个文件。然后建一个Action节点,选择BehaviorTree Reference即可引用行为树。
1.编辑器
第1-5个按钮用于选择要编辑的行为树
Referenced Behaviors可以查看当前行为树引用的行为树(可以通过Actions节点下的Behavior Tree Reference引用行为树)
- :删除当前行为树
+ :为当前物体添加一个新的行为树组件
Lock :锁定当前行为树,即使选择其他的游戏物体也不会改变当前的视图
2.生命周期
3.常用API
using UnityEngine; using System.Collections; using System.Collections.Generic; using BehaviorDesigner.Runtime.Tasks; using BehaviorDesigner.Runtime; using BehaviorDesigner.Runtime.Tasks.Basic.UnityDebug; [TaskCategory("Custom")] [TaskDescription("AITest")] public class AITest : Action { public SharedString ss; public string s; public override void OnStart() { //1.同一行为树下的task之间的通信 BehaviorTree bt = GetComponent<BehaviorTree>(); var v = bt.FindTask<Log>(); v.text = "!!"; //2.访问shared变量 Debug.Log(bt.GetVariable("AA")); bt.SetVariable("AA", ss); Debug.Log(bt.GetVariable("AA")); bt.SetVariableValue("AA", s); Debug.Log(bt.GetVariable("AA")); //3.访问global变量 Debug.Log(GlobalVariables.Instance.GetVariable("BB")); GlobalVariables.Instance.SetVariableValue("BB", s); Debug.Log(GlobalVariables.Instance.GetVariable("BB")); } }
4.
a.如何停止AI
直接将BehaviorTree组件禁用掉并不能停止AI。先要将预制的BehaviorTree组件禁用掉,然后将PauseWhenDisable勾选。此时通过脚本enabled行为树即可自由控制行为树的开启和关闭了。
b.如何引用另一棵行为树
在行为树编辑界面上,右键Save XXX,即可将当前行为树保存为一个文件。然后建一个Action节点,选择BehaviorTree Reference即可引用行为树。
相关文章推荐
- 关于PowerDesigner初体验的使用介绍
- Creating Rich Composite Activities
- Android(& Tizen Web App) Designer 所见即所得
- 利用计划任务和VBS脚本实现自动WEB共享文件夹里的文件
- c++ 覆盖、重载、隐藏
- MB Star Astrology comprises of Star Sign
- HTML语法
- HTML教學導覽
- Cocos2D的4个基本概念
- 中文乱码解决方案
- DELL笔记本数字小键盘设置
- clan, in the languagealso,wow gold
- SWTOR power leveling
- The council said he had shown
- 中科大-喜迎校庆
- oracle10g on AIX 调优笔记
- 右键菜单
- 软核,硬核、固核的区别!(整理总结)
- Some understanding about the MVC
- Intro:Repeating Actions with Loops