21 lines
444 B
C#
21 lines
444 B
C#
using System.Collections.Generic;
|
|
|
|
namespace AI.BehaviorTrees {
|
|
public class CompositeNode : BTNode {
|
|
protected readonly List<BTNode> children = new List<BTNode>();
|
|
|
|
public override bool Tick() {
|
|
foreach (BTNode child in children) {
|
|
if (!child.Tick())
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void AddChild(BTNode child) {
|
|
if (child != null)
|
|
children.Add(child);
|
|
}
|
|
}
|
|
}
|