2024-04-28 13:55:19 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
2024-05-08 10:22:04 +00:00
|
|
|
|
public AiCharacter? Character { get; set; }
|
2024-04-28 13:55:19 +00:00
|
|
|
|
protected override IBehaviorTreeNode CreateRoot()
|
|
|
|
|
{
|
2024-05-08 10:22:04 +00:00
|
|
|
|
var patrolNode = new AiPatrolNode();
|
|
|
|
|
var aiWalkNode = new AiWalkNode();
|
|
|
|
|
var aiRotorNode = new AiRotorNode();
|
|
|
|
|
var aIPickNode = new AiPickNode();
|
|
|
|
|
var aiAttackNode = new AiAttackNode();
|
2024-04-28 13:55:19 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 10:22:04 +00:00
|
|
|
|
protected override string? CreateId()
|
2024-04-28 13:55:19 +00:00
|
|
|
|
{
|
|
|
|
|
return Config.BehaviorTreeId.Patrol;
|
|
|
|
|
}
|
|
|
|
|
}
|