private void ToggleChoicepoint(Sequence seq, int cpPos) { int cpCounter = 0; // dummy SequenceRandomChoice cpSeq = GetSequenceAtChoicepointPosition(seq, cpPos, ref cpCounter); cpSeq.Choice = !cpSeq.Choice; }
private static void PrintChoice(SequenceRandomChoice seq, PrintSequenceContext context) { if (seq.Choice) { WorkaroundManager.Workaround.PrintHighlighted("-%" + context.cpPosCounter + "-:", HighlightingMode.Choicepoint); } else { WorkaroundManager.Workaround.PrintHighlighted("+%" + context.cpPosCounter + "+:", HighlightingMode.Choicepoint); } }
private SequenceRandomChoice GetSequenceAtChoicepointPosition(Sequence seq, int cpPos, ref int counter) { if (seq is SequenceRandomChoice && ((SequenceRandomChoice)seq).Random) { if (counter == cpPos) { return((SequenceRandomChoice)seq); } counter++; } foreach (Sequence child in seq.Children) { SequenceRandomChoice res = GetSequenceAtChoicepointPosition(child, cpPos, ref counter); if (res != null) { return(res); } } return(null); }
static void PrintChoice(SequenceRandomChoice seq, PrintSequenceContext context) { if(seq.Choice) context.workaround.PrintHighlighted("-%" + context.cpPosCounter + "-:", HighlightingMode.Choicepoint); else context.workaround.PrintHighlighted("+%" + context.cpPosCounter + "+:", HighlightingMode.Choicepoint); }