private PerformBaseNode BuildMainNode(LuaTable nodeVO) { PerformBaseNode node = null; NodeType type = (NodeType)nodeVO.Get <int>("nodeType"); switch (type) { case NodeType.Summon: node = new SummonNode(); node.InjectData(nodeVO); break; } node.childs = new List <PerformBaseNode>(); int childCount = nodeVO.Get <int>("childCount"); if (childCount > 0) { LuaTable childs = nodeVO.Get <LuaTable>("childs"); for (int i = 0; i < childCount; ++i) { node.childs.Add(BuildMainNode(childs.Get <LuaTable>((i + 1).ToString()))); } } return(node); }
//处理主干节点 private void ExcuteMainNode() { if (curMainNode == null || curMainNode.Perform(Time.deltaTime)) { if (mainPerformQue.Count == 0) { curMainNode = null; return; } //execute new main node curMainNode = mainPerformQue[0]; mainPerformQue.RemoveAt(0); if (curMainNode.childs != null && curMainNode.childs.Count > 0) { for (int i = 0; i < curMainNode.childs.Count; ++i) { curSubNodes.Add(curMainNode.childs[i]); } } } }