internal void InformListeners(TaskPhase phase) { CheckDisposed(); m_phase = phase; InformListeners(this); }
internal TaskReport(string description, TaskReport owningTask) { m_owningTask = owningTask; m_phase = TaskPhase.Started; m_description = description; m_start = DateTime.Now.Ticks; }
// public TaskReport(string description) // { // m_phase=TaskPhase.started; // m_description = description; // m_start = DateTime.Now.Ticks; // } internal TaskReport(string description, TaskReport owningTask) { m_OwningTask = owningTask; m_phase=TaskPhase.started; m_description = description; m_start = DateTime.Now.Ticks; }
/// <summary> /// Checks whether the interaction technique supports the required tasks types. /// </summary> private bool TechniqueSupportsTask(TaskPhase taskPhase, InteractionTechniqueConf technique, Task task) { // technique does not support required distance if (task.distance > technique.maxSupportedDistance) { return(false); } // task does not support required task if (taskPhase != TaskPhase.Training && !technique.supportedTaskTypes.HasFlag(task.taskTypes)) { return(false); } if (taskPhase == TaskPhase.Training) { // task requires selection but technique does not support it if (task.taskTypes.HasFlag(TaskType.Selection) && !technique.supportedTaskTypes.HasFlag(TaskType.Selection)) { return(false); } // task requires manipulation task but technique does not support it // it is sufficient if technique supports any manipulation if a manipulation task type is required in a training task // the task will be adapted in the training phase so we don't need a training task for each task type and distance if (task.taskTypes > TaskType.Selection && technique.supportedTaskTypes <= TaskType.Selection) { return(false); } } return(true); }
public void EncounteredError(Exception error) { CheckDisposed(); m_phase = TaskPhase.errorEncountered; m_currentError = error; InformListeners(this); }
/// <summary> /// Finishes the current technique and moves on to the pause phase. /// </summary> private void FinishTechnique() { RemoveAllObjects(); currentPhase = TaskPhase.Pause; chosenTechniques.RemoveAt(0); currentTechnique.SetActive(false); StatusTextController.Instance.UpdateStatusText(currentPhase.ToString()); noneTechnique.SetActive(true); MeasurementController.Instance.ResetMeasurementController(); }
private void MoveOn() { if (isMovingOn) { return; } // move on to the training phase if the current phase is pause if (currentPhase == TaskPhase.Pause) { // do nothing if there is no more interaction technique if (chosenTechniques.Count == 0) { return; } currentPhase = TaskPhase.Training; currentInstruction = -1; } // move on to the task phase if the current phase is training else if (currentPhase == TaskPhase.Training) { if (!InitializeTechnique()) { return; } currentPhase = TaskPhase.Tasks; } // abort current technique and move on to pause else if (currentPhase == TaskPhase.Tasks) { FinishTechnique(); return; } isMovingOn = true; SetStartPosition(); LoadNextTasks(); FadeOutAndRemoveTaskObjects(FadeInNextTaskObjects, currentPhase == TaskPhase.Tasks || currentPhase == TaskPhase.Training); }
void Awake() { currentGameObjects = new List <GameObject>(); // load and validate the interaction techniques which are chosen for the current run config = JsonHelper.DeserializeFromFile <Configuration>(Path.Combine(Application.streamingAssetsPath, "config.json")); chosenTechniques = new List <InteractionTechniqueConf>(); foreach (InteractionTechniqueConf it in config.interactionTechniques) { if (interactionTechniques.transform.Find(it.name) != null) { chosenTechniques.Add(it); } else { Debug.LogWarning("Technique " + it + " is not supported"); } } // set technique count for status text techniqueCount = chosenTechniques.Count; // start with pause currentPhase = TaskPhase.Pause; // update status text StatusTextController.Instance.UpdateStatusText(currentPhase.ToString()); // find the interim technique noneTechnique = interactionTechniques.transform.Find("None").gameObject; // add butten listener to finish task debugMoveOnAction.AddOnStateDownListener(FinishTaskActionCallback, GetPrimaryHand().handType); // add debug button to move on with a controller button if (debugMode) { debugMoveOnAction.AddOnStateDownListener(MoveOnActionCallback, GetPrimaryHand().otherHand.handType); } }
internal TaskReport AddSubTask(string description) { CheckDisposed(); Debug.Assert(m_phase != TaskPhase.Finished); var t = new TaskReport(description, this); if (m_subTasks == null) { m_subTasks = new List <TaskReport>(); } else { //a new set task should not be added until the previous one is finished. TaskPhase phase = m_subTasks[m_subTasks.Count - 1].Phase; Debug.Assert(phase == TaskPhase.Finished); // || phase == TaskPhase.ErrorEncountered); } m_subTasks.Add(t); //this cannot be in the constructor because if the listener asks //for the most recent task, it will not get this one until after //this has been added to the subtasks list. t.InformListeners(TaskPhase.Started); return(t); }
protected bool InstanceIsInPhase(TaskPhase phase) { return(orderPhasesFSM.CurrentState == phase); }
protected void InstanceSetPhase(TaskPhase phase) { orderPhasesFSM.CurrentState = phase; }
public bool IsInPhase(TaskPhase phase) { return(InstanceIsInPhase(phase)); }
public void SetPhase(TaskPhase phase) { InstanceSetPhase(phase); }