public BehaviorTreeEntity(long aiFunction, BehaviorTreeData data) { _iconditionCheck = new ConditionCheck(); //UnityEngine.Profiling.Profiler.BeginSample("Analysis"); _rootNode = BehaviorAnalysis.GetInstance().Analysis(aiFunction, data, _iconditionCheck, AddInvalidSubTree); //UnityEngine.Profiling.Profiler.EndSample(); if (null != _rootNode) { _entityId = _rootNode.EntityId; } }
public void Reset(BehaviorTreeData behaviorTreeData) { behaviorTreeData.nodeDic.Clear(); for (int i = 0; i < behaviorTreeData.nodeList.Count; ++i) { NodeValue nodeValue = behaviorTreeData.nodeList[i]; int index = EnumNames.GetEnumIndex <NODE_TYPE>((NODE_TYPE)nodeValue.NodeType); nodeValue.nodeName = EnumNames.GetEnumName <NODE_TYPE>(index); behaviorTreeData.nodeDic.Add(nodeValue.id, nodeValue); } BehaviorAnalysis.GetInstance().SetLoadConfigEvent(LoadConfig); _behaviorTreeEntity = new BehaviorTreeEntity(long.MaxValue, behaviorTreeData); BehaviorTreeEntity.CurrentDebugEntityId = _behaviorTreeEntity.EntityId; SetRunTimeDrawNode(_behaviorTreeEntity); NodeNotify.Clear(); }