Exemplo n.º 1
0
    void DeleteBranchCallback()
    {
        if (!EditorUtility.DisplayDialog("Delete branch ?",
                                         "Are you sure you want to delete the node " + this.selectedNode.displayedName + " and his children ?",
                                         "Yes, delete this branch", "No"))
        {
            return;
        }

        BehaviourTreeNode parent = FindParentOfNodeByID(BehaviourTreeEditorWindow.behaviourTree, this.selectedNode.ID);

        parent.RemoveChild(selectedNode);
        DeleteRecursivelyBranchAssets(selectedNode);
        AssetDatabase.Refresh();
        SaveBehaviourTree();
    }
Exemplo n.º 2
0
    void DeleteNodeCallback()
    {
        if (!EditorUtility.DisplayDialog("Delete node ?",
                                         "Are you sure you want to delete the node " + this.selectedNode.displayedName + " ?",
                                         "Yes, delete this node", "No"))
        {
            return;
        }

        BehaviourTreeNode parent = FindParentOfNodeByID(BehaviourTreeEditorWindow.behaviourTree, this.selectedNode.ID);

        if (this.selectedNode.ChildrenCount() > 0)
        {
            parent.ReplaceChild(this.selectedNode, this.selectedNode.GetChildren()[0]);
        }
        else
        {
            parent.RemoveChild(this.selectedNode);
        }

        DeleteNodeAsset(this.selectedNode);
        AssetDatabase.Refresh();
        SaveBehaviourTree();
    }