示例#1
0
        private void Clear()
        {
            m_serializedGraph?.Dispose();
            m_serializedGraph = null;

            m_agentGraph?.Dispose();
            m_agentGraph = null;

            m_selectedObject = null;
            m_selectedAgents = null;

            rootVisualElement.Clear();
        }
示例#2
0
        private void CreateAgentBehaviorTree([NotNull] BehaviorTreeAgent agent)
        {
            if (m_agentGraph != null)
            {
                rootVisualElement.Remove(m_agentGraph);
                m_agentGraph = null;
            }

            if (!(s_treeRootField.GetValue(agent) is TreeRoot treeRoot))
            {
                return;
            }

            var rootBehavior  = (Behavior)s_rootBehaviorField.GetValue(treeRoot);
            var behaviorInfos = new List <BehaviorInfo>();

            AddBehavior(behaviorInfos, rootBehavior, 0);

            m_agentGraph = new AgentBehaviorTreeGraph(behaviorInfos, treeRoot);
            m_agentGraph.style.flexGrow = 1f;
            rootVisualElement.Add(m_agentGraph);
        }