2024-04-28 13:55:19 +00:00
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace ColdMint.scripts.behaviorTree;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>BehaviorNode</para>
|
|
|
|
|
/// <para>行为节点</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class BehaviorNode : Node2D
|
|
|
|
|
{
|
2024-05-08 10:22:04 +00:00
|
|
|
|
public IBehaviorTreeNode? Root { get; set; }
|
2024-04-28 13:55:19 +00:00
|
|
|
|
|
|
|
|
|
public override void _PhysicsProcess(double delta)
|
|
|
|
|
{
|
|
|
|
|
InvokeBehaviorTreeNode(true, delta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <para>InvokeBehaviorTreeNode</para>
|
|
|
|
|
/// <para>调用行为树节点</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void InvokeBehaviorTreeNode(bool isPhysicsProcess, double delta)
|
|
|
|
|
{
|
|
|
|
|
if (Root == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Root.Execute(isPhysicsProcess, delta);
|
|
|
|
|
}
|
|
|
|
|
}
|