示例#1
0
 public IBehaviourNode GetState(IBehaviourNode sequence)
 {
     if (!nodeStates.ContainsKey(sequence))
     {
         return(null);
     }
     return(nodeStates[sequence]);
 }
示例#2
0
 // Use this for initialization
 void Start()
 {
     _Main = new ConcurrentNode(
         Utils.FirstOrDefault <BehaviourValue>,
         new FixedPriorityNode(
             new BehaviourCoroutine(SomeCoroutine()),
             new BehaviourCoroutine(SomeOtherCoroutine())),
         new BehaviourCoroutine(SomeThirdCoroutine()));
 }
 public PiratePart(EnemyBehaviourFactory behaviourFactory, EnemyBrain brain, IPositionComponent Physical)
 {
     this.behaviourFactory = behaviourFactory;
     this.Brain            = brain;
     this.Physical         = Physical;
     behaviourTree         = CreateBehaviourTree();
     agent = new BehaviourTreeAgent(behaviourTree);
     Brain.LookDistance  = 20;
     Brain.ShootDistance = 5;
     Brain.ShootInterval = 2;
     Brain.GunDamage     = 20;
 }
 public ProximityChaseEnemyPart(EnemyBehaviourFactory behaviourFactory, EnemyBrain brain, IPositionComponent Physical)
 {
     BehaviourFactory    = behaviourFactory;
     behaviourTree       = CreateBehaviourTree();
     agent               = new BehaviourTreeAgent(behaviourTree);
     GunChargedTime      = -1;
     brain.LookDistance  = 20;
     brain.ShootDistance = 5;
     brain.ShootInterval = 2;
     brain.GunDamage     = 20;
     Brain               = brain;
     this.Physical       = Physical;
 }
示例#5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="condition"></param>
 /// <param name="node"></param>
 public IfNode(ConditionNode condition, IBehaviourNode node,string name)
     : base(name)
 {
     this.AddNode(condition);
     this.AddNode(node);
 }
示例#6
0
 public void AddNode(IBehaviourNode node)
 {
     node.parent = this;
     children.Add(node);
 }
示例#7
0
 public While(Func <bool> getWhileCondition, Func <bool> getSuccessCondition, IBehaviourNode child)
 {
     this.getWhileCondition   = getWhileCondition;
     this.getSuccessCondition = getSuccessCondition;
     this.child = child;
 }
示例#8
0
文件: Brain.cs 项目: zhaoluxyz/Hugula
 private string GetPath(IBehaviourNode current)
 {
     string re = "/" + current.name + "" + current.status;
     if (current.parent == null)
     {
         return re;
     }
     else
     {
         re += GetPath(current.parent);
         return re;
     }
 }
示例#9
0
文件: Brain.cs 项目: zhaoluxyz/Hugula
    private IBehaviourNode Foreach(IBehaviourNode node)
    {
        if (node is CompositeNode)
        {
            CompositeNode a = node as CompositeNode;
            //a.chie
            if (a.status == BehaviourStatus.Running)
            {
                IList<IBehaviourNode> list = a.getChildrens;
                foreach (var IBehav in list)
                {
                    if (IBehav.status == BehaviourStatus.Running)
                        return Foreach(IBehav);
                }
            }
        }
        else if (node.status == BehaviourStatus.Running)
        {
            return node;
        }

        return null;
    }
示例#10
0
 public void StoreState(IBehaviourNode sequence, IBehaviourNode state)
 {
     nodeStates[sequence] = state;
 }
示例#11
0
 public BehaviourTreeAgent(IBehaviourNode root)
 {
     this.root = root;
 }