public void SetNext(TaskEndState taskEndState, Task task) { if (next != null && task != null) { next.Add(taskEndState, task); } }
public void MoveNext(TaskEndState taskEndState) { Deactivate(); if (taskEndState != TaskEndState.None && next.ContainsKey(taskEndState) && next[taskEndState] != null) { next[taskEndState].Activate(); } }
public bool Proceed() { if (entrance == null || exit == null) { throw new MissingComponentException(); } if (!isActivated) { return(false); } bool resultFromExit = false; if (state == TaskProgressState.Idle) { if (entrance.CheckPassive()) { state = TaskProgressState.Started; startingTime = new TimeState(TimeState.GetGlobalTimer()); cantSkipInterval = GlobalConstraint.TASK_CANT_SKIP_INTERVAL; entrance.Deactivate(); exit.ActivateAndStartMonitoring(); } } else if (state == TaskProgressState.Started) { for (int i = 0; i < instructions.Count; i++) { instructions[i].Proceed(); if (!instructions[i].isAudioInstructionEnded()) { cantSkipInterval--; } } exit.CheckPassive(); resultFromExit = exit.IsSatisfied(); if (resultFromExit && cantSkipInterval < 0) { TaskEndState evaluateResult = Evaluate(); if (evaluateResult == TaskEndState.Correct) { state = TaskProgressState.Ended; for (int i = 0; i < instructions.Count; i++) { instructions[i].WrapUp(); } MoveNext(evaluateResult); } } } return(resultFromExit); }