Esempio n. 1
0
        public override void OnBeforeSerialize(BTAsset btAsset)
        {
            base.OnBeforeSerialize(btAsset);

            if (string.IsNullOrEmpty(m_behaviourTreeID))
            {
                m_behaviourTreeID = BTUtils.GenerateUniqueStringID();
            }

            btAsset.SetSubtreeAsset(m_behaviourTreeID, m_behaviourTreeAsset);
        }
Esempio n. 2
0
        public void Serialize()
        {
            if (m_editModeTree != null)
            {
                m_editModeTree.Root.OnBeforeSerialize(this);

                string serializedData = BTUtils.SerializeTree(m_editModeTree);
                if (serializedData != null)
                {
                    m_serializedData = serializedData;
                }
            }
        }
Esempio n. 3
0
        public BehaviourTree CreateRuntimeTree()
        {
            BehaviourTree tree = BTUtils.DeserializeTree(m_serializedData);

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

            tree.Root.OnAfterDeserialize(this);
            tree.ReadOnly = true;
            return(tree);
        }
Esempio n. 4
0
        public BehaviourTree GetEditModeTree()
        {
            if (m_editModeTree == null)
            {
                m_editModeTree = BTUtils.DeserializeTree(m_serializedData);
                if (m_editModeTree != null)
                {
                    m_editModeTree.Root.OnAfterDeserialize(this);
                    m_editModeTree.ReadOnly = false;
                }
            }

            return(m_editModeTree);
        }