Search in sources :

Example 1 with BehaviorTreeData

use of org.terasology.engine.logic.behavior.asset.BehaviorTreeData in project Terasology by MovingBlocks.

the class CollectiveBehaviorSystem method createTree.

public BehaviorTree createTree(String name, BehaviorNode root) {
    BehaviorTreeData data = new BehaviorTreeData();
    data.setRoot(root);
    BehaviorTree behaviorTree = assetManager.loadAsset(new ResourceUrn(BEHAVIORS, new Name(name.replaceAll("\\W+", ""))), data, BehaviorTree.class);
    trees.add(behaviorTree);
    save(behaviorTree);
    return behaviorTree;
}
Also used : BehaviorTreeData(org.terasology.engine.logic.behavior.asset.BehaviorTreeData) BehaviorTree(org.terasology.engine.logic.behavior.asset.BehaviorTree) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) Name(org.terasology.gestalt.naming.Name)

Example 2 with BehaviorTreeData

use of org.terasology.engine.logic.behavior.asset.BehaviorTreeData in project Terasology by MovingBlocks.

the class BehaviorSystem method createTree.

public BehaviorTree createTree(String name, BehaviorNode root) {
    BehaviorTreeData data = new BehaviorTreeData();
    data.setRoot(root);
    BehaviorTree behaviorTree = assetManager.loadAsset(new ResourceUrn(BEHAVIORS, new Name(name.replaceAll("\\W+", ""))), data, BehaviorTree.class);
    trees.add(behaviorTree);
    save(behaviorTree);
    return behaviorTree;
}
Also used : BehaviorTreeData(org.terasology.engine.logic.behavior.asset.BehaviorTreeData) BehaviorTree(org.terasology.engine.logic.behavior.asset.BehaviorTree) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) Name(org.terasology.gestalt.naming.Name)

Aggregations

BehaviorTree (org.terasology.engine.logic.behavior.asset.BehaviorTree)2 BehaviorTreeData (org.terasology.engine.logic.behavior.asset.BehaviorTreeData)2 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)2 Name (org.terasology.gestalt.naming.Name)2