TowerDefenseGame/Assets/Scripts/Runtime/AI/BehaviorTrees/CompositeNode.cs
2025-06-28 14:49:54 -07:00

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);
}
}
}