Example #1
0
        public void ExportTree(DialogueTree export)
        {
            owner     = export.owner;
            nodes     = new List <SerializableNode>();
            links     = new List <SerializableNode>();
            tempNodes = new Dictionary <Node, SerializableNode>();

            ExportNode(export.root);
            ExportLinks();
            tempNodes = null;
        }
Example #2
0
        public DialogueTree ImportTree()
        {
            DialogueTree imported = null;

            if (nodes != null && nodes.Count > 0 && links != null)
            {
                imported       = new DialogueTree();
                imported.owner = owner;
                ImportChildNodes(imported.root, nodes[0]);
                ImportLinks();
            }

            return(imported);
        }
Example #3
0
        public SerializableTree ExportInstance(DialogueTree export)
        {
            if (instance == this)
            {
                ExportTree(export);
                return(this);
            }
            else
            {
                instance.ExportTree(export);
                SerializableTree newPrefab = this;

                #if UNITY_EDITOR
                newPrefab          = UnityEditor.PrefabUtility.ReplacePrefab(instance.gameObject, this, UnityEditor.ReplacePrefabOptions.ConnectToPrefab).GetComponent <SerializableTree>();
                newPrefab.instance = instance;
                #endif

                return(newPrefab);
            }
        }