Traveller/scripts/behaviorTree/BehaviorNode.cs
Cold-Mint 95515ddab2
When the selected item slot A is selected, pressing the shortcut key of item slot A again will no longer invoke the press event of A.
当选中物品槽A时,再次按下物品槽A的快捷键,就不能再调用A的按下事件了。
2024-06-06 21:05:51 +08:00

30 lines
683 B
C#

using Godot;
namespace ColdMint.scripts.behaviorTree;
/// <summary>
/// <para>BehaviorNode</para>
/// <para>行为节点</para>
/// </summary>
public partial class BehaviorNode : Node2D
{
public IBehaviorTreeNode? Root { get; set; }
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);
}
}