Package org.terasology.logic.behavior.asset

Examples of org.terasology.logic.behavior.asset.BehaviorTree


            }
        });
        assetManager.setAssetFactory(AssetType.BEHAVIOR, new AssetFactory<BehaviorTreeData, BehaviorTree>() {
            @Override
            public BehaviorTree buildAsset(AssetUri uri, BehaviorTreeData data) {
                return new BehaviorTree(uri, data);
            }
        });
        assetManager.setAssetFactory(AssetType.UI_ELEMENT, new AssetFactory<UIData, UIElement>() {
            @Override
            public UIElement buildAsset(AssetUri uri, UIData data) {
View Full Code Here


        for (AssetUri uri : assetManager.listAssets(AssetType.SOUND)) {
            uris.add(uri);
        }
        for (AssetUri uri : assetManager.listAssets(AssetType.BEHAVIOR)) {

            BehaviorTree asset = assetManager.loadAsset(uri, BehaviorTree.class);
            if (asset != null) {
                trees.add(asset);
            }
        }
    }
View Full Code Here

    }

    public BehaviorTree createTree(String name, Node root) {
        BehaviorTreeData data = new BehaviorTreeData();
        data.setRoot(root);
        BehaviorTree behaviorTree = new BehaviorTree(new AssetUri(AssetType.BEHAVIOR, BEHAVIORS, name.replaceAll("\\W+", "")), data);
        trees.add(behaviorTree);
        save(behaviorTree);
        return behaviorTree;
    }
View Full Code Here

    private void addEntity(EntityRef entityRef, BehaviorComponent behaviorComponent) {
        Interpreter interpreter = entityInterpreters.get(entityRef);
        if (interpreter == null) {
            interpreter = new Interpreter(new Actor(entityRef));
            BehaviorTree tree = behaviorComponent.tree;
            entityInterpreters.put(entityRef, interpreter);
            if (tree != null) {
                interpreter.start(tree.getRoot());
            }
        }
    }
View Full Code Here

        });

        WidgetUtil.trySubscribe(this, "layout", new ActivateEventListener() {
            @Override
            public void onActivated(UIWidget button) {
                BehaviorTree selection = selectTree.getSelection();
                if (selection != null) {
                    selection.layout(selectedNode);
                }
            }
        });

        WidgetUtil.trySubscribe(this, "new", new ActivateEventListener() {
View Full Code Here

TOP

Related Classes of org.terasology.logic.behavior.asset.BehaviorTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.