Traveller/scripts/behaviorTree/behavior/PatrolBehaviorTree.cs
Cold-Mint b8b8e81d8f
Review the merged code to resolve an issue where the game is unresponsive after a player dies.
审查合并后的代码,解决玩家死亡后游戏无响应的问题。
2024-06-13 22:29:18 +08:00

36 lines
1.1 KiB
C#

using ColdMint.scripts.behaviorTree.ai;
using ColdMint.scripts.character;
namespace ColdMint.scripts.behaviorTree.behavior;
/// <summary>
/// <para>Represents a behavior tree for patrol</para>
/// <para>表示巡逻的行为树</para>
/// </summary>
public class PatrolBehaviorTree : BehaviorTreeTemplate
{
public AiCharacter? Character { get; set; }
protected override IBehaviorTreeNode CreateRoot()
{
var patrolNode = new AiPatrolNode();
var aiWalkNode = new AiWalkNode();
var aiRotorNode = new AiRotorNode();
var aIPickNode = new AiPickNode();
var aiAttackNode = new AiAttackNode();
aiWalkNode.Character = Character;
patrolNode.Character = Character;
aiRotorNode.Character = Character;
aIPickNode.Character = Character;
aiAttackNode.Character = Character;
patrolNode.AddChild(aiWalkNode);
patrolNode.AddChild(aiRotorNode);
patrolNode.AddChild(aIPickNode);
patrolNode.AddChild(aiAttackNode);
return patrolNode;
}
protected override string CreateId()
{
return Config.BehaviorTreeId.Patrol;
}
}