Behavior Designer扩展

BehaviorManager.instance.Tick(behaviorTree); 卸载update里u3d直接卡死 = =

SharedVariable直接赋值会改变他的引用关系,必须用XXX.Value赋值 = =

http://www.opsive.com/assets/BehaviorDesigner/documentation.php

两种自定义Task:  Task 和 Parent Tasks

基础task流程 ( Conditional Task  和   Action Task )

Parent Tasks

  1. // The maximum number of children a parent task can have. Will usually be 1 or int.MaxValue
  2. public virtual int MaxChildren();
  3. // Boolean value to determine if the current task is a parallel task
  4. public virtual bool CanRunParallelChildren();
  5. // The index of the currently active child
  6. public virtual int CurrentChildIndex();
  7. // Boolean value to determine if the current task can execute
  8. public virtual bool CanExecute();
  9. // Apply a decorator to the executed status
  10. public virtual TaskStatus Decorate(TaskStatus status);
  11. // Notifies the parent task that the child has been executed and has a status of childStatus
  12. public virtual void OnChildExecuted(TaskStatus childStatus);
  13. // Notifies the parent task that the child at index childIndex has been executed and has a status of childStatus
  14. public virtual void OnChildExecuted(int childIndex, TaskStatus childStatus);
  15. // Notifies the task that the child has started to run
  16. public virtual void OnChildStarted();
  17. // Notifies the parallel task that the child at index childIndex has started to run
  18. public virtual void OnChildStarted(int childIndex);
  19. // Some parent tasks need to be able to override the status, such as parallel tasks
  20. public virtual TaskStatus OverrideStatus(TaskStatus status);
  21. // The interrupt node will override the status if it has been interrupted.
  22. public virtual TaskStatus OverrideStatus();
  23. // Notifies the composite task that an conditional abort has been triggered and the child index should reset
  24. public virtual void OnConditionalAbort(int childIndex);

父节点基础类ParentTask派生出装饰节点Decorator

  1. // The maximum number of children a parent task can have. Will usually be 1 or int.MaxValue
  2. public virtual int MaxChildren();
  3. // Boolean value to determine if the current task is a parallel task
  4. public virtual bool CanRunParallelChildren();
  5. // The index of the currently active child
  6. public virtual int CurrentChildIndex();
  7. // Boolean value to determine if the current task can execute
  8. public virtual bool CanExecute();
  9. // Apply a decorator to the executed status
  10. public virtual TaskStatus Decorate(TaskStatus status);
  11. // Notifies the parent task that the child has been executed and has a status of childStatus
  12. public virtual void OnChildExecuted(TaskStatus childStatus);
  13. // Notifies the parent task that the child at index childIndex has been executed and has a status of childStatus
  14. public virtual void OnChildExecuted(int childIndex, TaskStatus childStatus);
  15. // Notifies the task that the child has started to run
  16. public virtual void OnChildStarted();
  17. // Notifies the parallel task that the child at index childIndex has started to run
  18. public virtual void OnChildStarted(int childIndex);
  19. // Some parent tasks need to be able to override the status, such as parallel tasks
  20. public virtual TaskStatus OverrideStatus(TaskStatus status);
  21. // The interrupt node will override the status if it has been interrupted.
  22. public virtual TaskStatus OverrideStatus();
  23. // Notifies the composite task that an conditional abort has been triggered and the child index should reset
  24. public virtual void OnConditionalAbort(int childIndex);
时间: 2024-08-10 19:03:41

Behavior Designer扩展的相关文章

基于行为树的AI 与 Behavior Designer插件

优点: 0.行为逻辑和状态数据分离,任何节点都可以反复利用. 1.高度模块化状态,去掉状态中的跳转逻辑,使得状态变成一个"行为". 2."行为"和"行为"之间的跳转是通过父节点(Composite)的类型来决定的(例如sequence或者selector) .比如并行处理两个行为,在状态机里面无法同时处理两个状态. 3.通过增加控制节点的类型,可以达到复用行为的目的. Behavior trees are a combination of man

Behavior Designer 行为树入门

本篇教程将带领大家熟悉 行为树插件之Behavior Designer .本篇教程不会出现过多的代码,故也适合策划学习.你将学习到一种新的动画与AI的解决方案使即使用Behavior Designer来设计动画的播放逻辑与AI的行为逻辑, 如果你用过PlayerMaker那么再好不过了,你可以Behavior Designer当作是PlayerMaker的强化版但有不同于PlayerMaker.当然我不是在这里推崇这种插件,而是了解另一种设计思路.当然在现在国内对于Behavior Design

Unity中的行为树插件:Behavior Designer

外国技术人员的插件:http://www.opsive.com/assets/BehaviorDesigner 目前公司内部比较推崇的行为树插件就是这个,虽然有其他几个同类的竞品. 说一句题外话,优秀的插件总是外国人开发的,并且可以将插件开发做成一个小工作室或者个人的主要收入来源,但没看到国人有类似的作品出现. 行为树的概念出现已经很多年了,总的来说,就是使用各种经典的控制节点+行为节点进行组合,从而实现复杂的AI.目前在游戏中一般复杂的AI都可以看到行为树的身影,简单的AI可以使用状态机来实现

[Unity插件]Behavior Designer:制作敌人AI

一个简单的敌人AI: 当处于监视范围内,跑向玩家:当处于攻击范围内,攻击玩家:否则呆在原地.用行为树表示就是: 其中当前行为树的变量与全局变量为: 效果图: 制作简单的AI确实不需要写代码,不过配置起来确实有点麻烦了.可以根据需求,编写自定义的节点来组成复杂的AI. 当游戏需要大量的AI时,Behavior Designer确实是一个不错的选择,因为自定义的节点可以不断被重用了.

Behavior Designer中的内置消息机制

最近在用Behavior Designer,其中需要用到消息机制,看了一下行为树其中自带了这套东西 注册 Owner.RegisterEvent<string>("Message", Message); 反注册 Owner.UnregisterEvent<string>("Message", Message); 发送消息 Owner.SendEvent("Message", "Finished B Action&

Behavior Designer笔记

1.总览 Behavior Designer是一个行为树程序.他为所有人设计-程序美工策划.Behavior Designer提供很好很强大的API,允许你愉快的进行玩耍.他和PlayMaker和uScript插件完美结合,提供直观可视化编辑器类.你可以不写一行代码也能创造复杂AI. 这篇文章将为Behavior Designer所有方面进行一次总体介绍.如果你不知道啥子是行为树,现在老子就告诉你. 行为树是一种流行AI技术.许多游戏都用到,HALO2是第一款使用行为树的主流游戏.HALO2制作

【U3D】初识Behavior Designer行为树(一)

本系列文章由@萌萌的一天出品,未经博主允许不得转载.   Behavior Designer行为树插件介绍        Behavior Designer是U3D AssetStore上很优秀的一款插架,它在基于Behaviour Tree相关原理的基础上拓展出了更加复杂的模块,并且运用了很强大的人工智能技术.第一个将Behaviour Tree概念应用到游戏的产品是Xbox上的<Halo 2>,之后更多的游戏开发者选择应用Behavior Tree而不是Hierarchical FSM来控

Behavior Designer中Wait节点的坑

某一组行为放在并行节点下,并且包含Wait节点动作.当等待时间不达到时它会返回Runing 造成整个行为树阻塞 应该考虑写一个CD时间装饰器来解决此类问题,当CD时间未到返回Failure

[Unity插件]Behavior Designer:SharedVariable与GlobalVariable

设置SharedVariable与GlobalVariable: 上面的SharedV是SharedVariable,变量范围是当前行为树: 下面的GlobalV是GlobalVariable,变量范围是所有的行为树. SharedVariable与普通变量的区别: SharedVariable可以引用上面设置的变量,省去了拖拽的操作,如果同一个物体被多个节点引用,则可以将该物体设置为SharedVariable using UnityEngine; namespace BehaviorDesi