Beispiel #1
0
        public virtual BehaviourTree CreateRuntimeTree()
        {
            BehaviourTree tree = BTUtils.DeserializeTree(m_serializedData);

            if (tree == null)
            {
                tree = new BehaviourTree();
            }

            tree.Root.OnAfterDeserialize(this);
            tree.ReadOnly = true;
            return(tree);
        }
Beispiel #2
0
        public virtual BehaviourTree GetEditModeTree()
        {
            string nm = this.name;

            if (m_editModeTree == null)
            {
                m_editModeTree = BTUtils.DeserializeTree(m_serializedData);
                if (m_editModeTree != null)
                {
                    if (string.IsNullOrEmpty(m_editModeTree.guidString) || lastFileName != this.name)
                    {
                        m_editModeTree.guidString = BTUtils.GenerateUniqueStringID();
                    }
                    m_editModeTree.Root.OnAfterDeserialize(this);
                    m_editModeTree.ReadOnly = false;
                }
            }

            return(m_editModeTree);
        }
Beispiel #3
0
        public BehaviourTree CreateRuntimeSubTree(int subTreeIndex)
        {
            if (subTreeIndex < 0 || subTreeIndex >= indexedSubTrees.Length)
            {
                return(null);
            }

            if (indexedSubTrees[subTreeIndex] == null)
            {
                return(null);
            }

            BehaviourTree tree = BTUtils.DeserializeTree(indexedSubTrees[subTreeIndex].SerializedData);

            if (tree == null)
            {
                tree = new BehaviourTree();
            }

            tree.Root.OnAfterDeserialize(indexedSubTrees[subTreeIndex]);
            tree.ReadOnly = true;
            return(tree);
        }