Traveller/scripts/behaviorTree/framework/SelectorNode.cs

27 lines
1006 B
C#
Raw Normal View History

2024-04-28 13:55:19 +00:00
namespace ColdMint.scripts.behaviorTree.framework;
/// <summary>
/// <para>Selector node</para>
/// <para>选择器节点</para>
/// </summary>
/// <remarks>
///<para>Select an execution of the child node and pass the execution result to the parent node</para>
///<para>选择其子节点的某一个执行,并将执行结果传递给父节点</para>
/// </remarks>
public abstract class SelectorNode : BehaviorTreeNodeTemplate
{
public override int Execute(bool isPhysicsProcess, double delta)
{
var behaviorTreeNode = SelectNode(isPhysicsProcess, delta, Children);
return behaviorTreeNode?.Execute(isPhysicsProcess, delta) ?? Config.BehaviorTreeResult.Failure;
2024-04-28 13:55:19 +00:00
}
/// <summary>
/// <para>Select an abstract method for the node</para>
/// <para>选择节点的抽象方法</para>
/// </summary>
/// <returns></returns>
protected abstract IBehaviorTreeNode? SelectNode(bool isPhysicsProcess, double delta, IBehaviorTreeNode[] children);
2024-04-28 13:55:19 +00:00
}