Esempio n. 1
0
        protected override int OnExcute(NodeData wData)
        {
            NodeControlSequenceContext thisContext = GetContext <NodeControlSequenceContext>(wData);
            int runningStatus = NodeState.FINISHED;

            //执行一下选择节点
            Node node = GetChild <Node>(thisContext.currentSelectedIndex);

            runningStatus = node.Execute(wData);

            //错误判断
            if (NodeState.IsError(runningStatus))
            {
                thisContext.currentSelectedIndex = -1;
                return(runningStatus);
            }

            //完成判断
            if (NodeState.IsFinished(runningStatus))
            {
                //下移索引
                thisContext.currentSelectedIndex++;
                if (IsIndexValid(thisContext.currentSelectedIndex))
                {
                    runningStatus = NodeState.EXECUTING;
                }
                else
                {
                    thisContext.currentSelectedIndex = -1;
                }
            }
            return(runningStatus);
        }