Exemple #1
0
        void InitCommonNodes(GraphInfo graphInfo)
        {
            commonNodeDictionary = new Dictionary <int, NodeBase>();

            int nodeCount = graphInfo.CommonNodeIdsLength;

            for (int i = 0; i < nodeCount; i++)
            {
                int nodeId = graphInfo.CommonNodeIds(i);

                NodeBase node = DeserializeNode(nodeId);
                node.isCommonNode = true;
                node.SetGraphBehaviour(this);
                commonNodeDictionary.Add(nodeId, node);
            }
        }
Exemple #2
0
        /// <summary>
        /// 创建NodeSequence,会共用传入的rootNode
        /// </summary>
        /// <param name="rootNode"></param>
        /// <param name="sequenceNodeIds"></param>
        /// <param name="graphBehaviour"></param>
        /// <param name="parentSequence"></param>
        public NodeSequence(NodeBase rootNode, int[] sequenceNodeIds, GraphBehaviour graphBehaviour, NodeSequence parentSequence)
        {
            GraphBehaviour      = graphBehaviour;
            RootNode            = rootNode;
            this.parentSequence = parentSequence;

            RootNode.SetGraphBehaviour(graphBehaviour);
            RootNode.SetNodeSequence(this);

            sequenceNodeDictionary = new Dictionary <int, NodeBase>();
            sequenceNodeDictionary.Add(RootNode.nodeId, RootNode);
            for (int i = 0; i < sequenceNodeIds.Length; i++)
            {
                NodeBase sequenceNode = graphBehaviour.DeserializeNode(sequenceNodeIds[i]);
                sequenceNode.SetNodeSequence(this);
                sequenceNode.SetGraphBehaviour(graphBehaviour);
                sequenceNodeDictionary.Add(sequenceNodeIds[i], sequenceNode);
            }

            runningNodeList       = new List <NodeBase>();
            executeFinishNodeList = new List <NodeBase>();

            runningChildSequenceList = new List <NodeSequence>();
        }