public class BehaviorTreeLibrary
extends java.lang.Object
BehaviorTreeLibrary is a repository of behavior tree archetypes. Behavior tree archetypes never run. Indeed, they are
only cloned to create behavior tree instances that can run.| Modifier and Type | Field and Description |
|---|---|
protected BehaviorTreeParser<?> |
parser |
protected com.badlogic.gdx.utils.ObjectMap<java.lang.String,BehaviorTree<?>> |
repository |
protected com.badlogic.gdx.assets.loaders.FileHandleResolver |
resolver |
| Constructor and Description |
|---|
BehaviorTreeLibrary()
Creates a
BehaviorTreeLibrary using the new internal resolver returned by the call
GdxAI.getFileSystem().newResolver(FileType.Internal). |
BehaviorTreeLibrary(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
Creates a
BehaviorTreeLibrary with the given resolver. |
BehaviorTreeLibrary(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver,
int parseDebugLevel)
Creates a
BehaviorTreeLibrary with the given resolver and debug level. |
BehaviorTreeLibrary(int parseDebugLevel)
Creates a
BehaviorTreeLibrary with the given debug level and using the new internal resolver returned by the call
GdxAI.getFileSystem().newResolver(FileType.Internal). |
| Modifier and Type | Method and Description |
|---|---|
<T> BehaviorTree<T> |
createBehaviorTree(java.lang.String treeReference)
Creates the
BehaviorTree for the specified reference. |
<T> BehaviorTree<T> |
createBehaviorTree(java.lang.String treeReference,
T blackboard)
Creates the
BehaviorTree for the specified reference and blackboard object. |
<T> Task<T> |
createRootTask(java.lang.String treeReference)
Creates the root task of
BehaviorTree for the specified reference. |
boolean |
hasArchetypeTree(java.lang.String treeReference)
Returns
true if an archetype tree with the specified reference is registered in this library. |
void |
registerArchetypeTree(java.lang.String treeReference,
BehaviorTree<?> archetypeTree)
Registers the
BehaviorTree archetypeTree with the specified reference. |
protected BehaviorTree<?> |
retrieveArchetypeTree(java.lang.String treeReference)
Retrieves the archetype tree from the library.
|
protected com.badlogic.gdx.utils.ObjectMap<java.lang.String,BehaviorTree<?>> repository
protected com.badlogic.gdx.assets.loaders.FileHandleResolver resolver
protected BehaviorTreeParser<?> parser
public BehaviorTreeLibrary()
BehaviorTreeLibrary using the new internal resolver returned by the call
GdxAI.getFileSystem().newResolver(FileType.Internal).public BehaviorTreeLibrary(int parseDebugLevel)
BehaviorTreeLibrary with the given debug level and using the new internal resolver returned by the call
GdxAI.getFileSystem().newResolver(FileType.Internal).parseDebugLevel - the debug level the parser will usepublic BehaviorTreeLibrary(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
BehaviorTreeLibrary with the given resolver.resolver - the FileHandleResolverpublic BehaviorTreeLibrary(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver,
int parseDebugLevel)
BehaviorTreeLibrary with the given resolver and debug level.resolver - the FileHandleResolverparseDebugLevel - the debug level the parser will usepublic <T> Task<T> createRootTask(java.lang.String treeReference)
BehaviorTree for the specified reference.treeReference - the tree identifier, typically a pathcom.badlogic.gdx.utils.SerializationException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.public <T> BehaviorTree<T> createBehaviorTree(java.lang.String treeReference)
BehaviorTree for the specified reference.treeReference - the tree identifier, typically a pathcom.badlogic.gdx.utils.SerializationException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.public <T> BehaviorTree<T> createBehaviorTree(java.lang.String treeReference, T blackboard)
BehaviorTree for the specified reference and blackboard object.treeReference - the tree identifier, typically a pathblackboard - the blackboard object (it can be null).com.badlogic.gdx.utils.SerializationException - if the reference cannot be successfully parsed.TaskCloneException - if the archetype cannot be successfully parsed.protected BehaviorTree<?> retrieveArchetypeTree(java.lang.String treeReference)
treeReference - the tree identifier, typically a pathcom.badlogic.gdx.utils.SerializationException - if the reference cannot be successfully parsed.public void registerArchetypeTree(java.lang.String treeReference,
BehaviorTree<?> archetypeTree)
BehaviorTree archetypeTree with the specified reference. Existing archetypes in the repository with
the same treeReference will be replaced.treeReference - the tree identifier, typically a path.archetypeTree - the archetype tree.java.lang.IllegalArgumentException - if the archetypeTree is nullpublic boolean hasArchetypeTree(java.lang.String treeReference)
true if an archetype tree with the specified reference is registered in this library.treeReference - the tree identifier, typically a path.true if the archetype is registered already; false otherwise.