<?xml version="1.0" encoding="UTF-8" ?>
<class name="BehaviorTree" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
	<brief_description>
		Contains Behavior Tree data.
	</brief_description>
	<description>
		Behavior Trees are hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies, entities). They are designed to make it easier to create complex and highly modular behaviors for your games.
		Behavior Trees are composed of tasks that represent specific actions or decision-making rules. Tasks can be broadly categorized into two main types: control tasks and leaf tasks. Control tasks determine the execution flow within the tree. They include [BTSequence], [BTSelector], and [BTInvert]. Leaf tasks represent specific actions to perform, like moving or attacking, or conditions that need to be checked. The [BTTask] class provides the foundation for various building blocks of the Behavior Trees. BT tasks can share data with the help of [Blackboard]. See [member BTTask.blackboard] and [Blackboard].
		[b]Note:[/b] To create your own actions, extend the [BTAction] class.
		The BehaviorTree is executed from the root task and follows the rules specified by the control tasks, all the way down to the leaf tasks, which represent the actual actions that the agent should perform or conditions that should be checked. Each task returns a status when it is executed. It can be [code]SUCCESS[/code], [code]RUNNING[/code], or [code]FAILURE[/code]. These statuses determine how the tree progresses. They are defined in [enum BT.Status].
		Behavior Trees handle conditional logic using condition tasks. These tasks check for specific conditions and return either [code]SUCCESS[/code] or [code]FAILURE[/code] based on the state of the agent or its environment (e.g., "IsLowOnHealth", "IsTargetInSight"). Conditions can be used together with [BTSequence] and [BTSelector] to craft your decision-making logic.
		[b]Note[/b]: To create your own conditions, extend the [BTCondition] class.
		Check out the [BTTask] class, which provides the foundation for various building blocks of Behavior Trees.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="clone" qualifiers="const">
			<return type="BehaviorTree" />
			<description>
				Makes a copy of the BehaviorTree resource.
			</description>
		</method>
		<method name="copy_other">
			<return type="void" />
			<param index="0" name="other" type="BehaviorTree" />
			<description>
				Become a copy of another behavior tree.
			</description>
		</method>
		<method name="get_root_task" qualifiers="const">
			<return type="BTTask" />
			<description>
				Returns the root task of the BehaviorTree resource.
			</description>
		</method>
		<method name="instantiate" qualifiers="const">
			<return type="BTTask" />
			<param index="0" name="agent" type="Node" />
			<param index="1" name="blackboard" type="Blackboard" />
			<param index="2" name="scene_root" type="Node" />
			<description>
				Instantiates the behavior tree and returns the root [BTTask]. [param scene_root] should be the root node of the scene that the Behavior Tree will be used in (e.g., the owner of the node that contains the behavior tree).
			</description>
		</method>
		<method name="set_root_task">
			<return type="void" />
			<param index="0" name="task" type="BTTask" />
			<description>
				Assigns a new root task to the [BehaviorTree] resource.
			</description>
		</method>
	</methods>
	<members>
		<member name="blackboard_plan" type="BlackboardPlan" setter="set_blackboard_plan" getter="get_blackboard_plan">
			Stores and manages variables that will be used in constructing new [Blackboard] instances.
		</member>
		<member name="description" type="String" setter="set_description" getter="get_description" default="&quot;&quot;">
			User-provided description of the BehaviorTree.
		</member>
	</members>
	<signals>
		<signal name="plan_changed">
			<description>
				Emitted when the [BlackboardPlan] changes.
			</description>
		</signal>
	</signals>
</class>
