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