private BehaviorTreeData LoadConfig(string fileName) { if (null == BehaviorManager.behaviorReadFile) { return(null); } BehaviorTreeData behaviorTreeData = BehaviorManager.behaviorReadFile(fileName, false); behaviorTreeData.nodeDic.Clear(); for (int i = 0; i < behaviorTreeData.nodeList.Count; ++i) { NodeValue nodeValue = behaviorTreeData.nodeList[i]; behaviorTreeData.nodeDic.Add(nodeValue.id, nodeValue); } return(behaviorTreeData); }
public List <NodeValue> GetSubTreeNode(int currentOpenSubTreeId) { List <NodeValue> nodeList = new List <NodeValue>(); NodeValue subTreeNode = BehaviorManager.Instance.GetNode(currentOpenSubTreeId); if (null == subTreeNode) { return(nodeList); } if (subTreeNode.subTreeType == (int)SUB_TREE_TYPE.NORMAL) { List <NodeValue> allNodeList = GetNodeList(); for (int i = 0; i < allNodeList.Count; ++i) { NodeValue nodeValue = allNodeList[i]; if (currentOpenSubTreeId >= 0 && nodeValue.parentSubTreeNodeId == currentOpenSubTreeId) { nodeList.Add(nodeValue); } } } else if (subTreeNode.subTreeType == (int)SUB_TREE_TYPE.CONFIG) { BehaviorTreeData data = null; if (null != BehaviorManager.behaviorReadFile) { data = BehaviorManager.behaviorReadFile(subTreeNode.subTreeConfig, false); } if (null != data) { nodeList.AddRange(data.nodeList); } } return(nodeList); }