private void CleanUp() { if (HasNext()) { bool lastRepeat = true; ItHelp ih = it.Peek(); if (ih.rep != ih.action.repetitions) //more iterations in loop { lastRepeat = false; } if (ih.seqIx >= ih.action.sequence.Length) { if (lastRepeat) { it.Pop(); CleanUp(); } else { ih.seqIx = 0; } } } }
public Action Next() { ItHelp ih = it.Peek(); Action next = ih.action.sequence[ih.seqIx]; ih.seqIx++; if (ih.seqIx >= ih.action.sequence.Length && ih.action.repetitions > 0) { ih.rep++; } if (next.action == DobAction.Sequence) { it.Push(new ItHelp(next)); return(Next()); } CleanUp(); return(next); }