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);
|
2024-05-08 10:22:04 +00:00
|
|
|
|
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>
|
2024-05-08 10:22:04 +00:00
|
|
|
|
protected abstract IBehaviorTreeNode? SelectNode(bool isPhysicsProcess, double delta, IBehaviorTreeNode[] children);
|
2024-04-28 13:55:19 +00:00
|
|
|
|
}
|