Exemplo 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);
        }
Exemplo 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;
                }
            }
        }
Exemplo 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);
        }
Exemplo 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);
        }