/// <summary> /// This method is called by the <see cref="MonoTargetBehaviour"/> when a NeuroTag ends its trial. /// It is updating the different hints to the incremented step, then make the NeuroTag flash, /// waiting for it to end before returning. /// </summary> /// <param name="tag">The tag which ended its trial</param> public IEnumerator OnTrialOver(NeuroTag tag) { currentStep++; UpdateParticleSystem(currentStep); // Make the breadcrump circle progress around the NeuroTag. StartCoroutine(SmoothProgression()); // Accelerate the simulation speed of the particles system during the flash. var main = particles.main; float originalSpeed = main.simulationSpeed; StartCoroutine(SmoothSetSimulationSpeed(1.5f, 0.25f)); yield return(StartCoroutine(Flash(tag))); if (currentStep == numberOfTrials) { // Accelerate the simulation StartCoroutine(SmoothSetSimulationSpeed(1f, 0.25f)); // Hide the Neurotag yield return(StartCoroutine(ShowTransform(neuroTagGroup, false))); } else { // Set back the simulation speed of the particles system to its original speed. StartCoroutine(SmoothSetSimulationSpeed(originalSpeed, 0.15f)); } }
public void Start() { _neuroTag = gameObject.GetComponent <NeuroTag>(); _identifier = gameObject.GetComponent <NeuroTagIdentifier>(); TargetManager.onTargetSet += ActivationHandler; ExperimentManager.onExperimentFinished += onDeactivated; }
/// <summary> /// Start the flash animation on the <paramref name="tag"/> and wait the animation end before returning. /// </summary> /// <param name="tag">The tag to flash</param> private IEnumerator Flash(NeuroTag tag) { FlashController flashController = tag.GetComponent<FlashController>(); if (flashController != null) { yield return NeuroManager.Instance.StartCoroutine(flashController.FlashCoroutine()); } }
public IEnumerator OnTrialBegin(NeuroTag tag) { // If it is the first step, show the Neurotag first if (currentStep == 0) { yield return StartCoroutine(preCalibrationGroup.Fade(0)); yield return StartCoroutine(ShowTransform(neuroTagGroup, true)); } }
private void Awake() { if (neuroTag == null) { neuroTag = GetComponentInChildren <NeuroTag>(); SetUpListeners(); } else { SetUpListeners(); } }
public override void OnEnterStep() { base.OnEnterStep(); // Place the objects on the first positions. for (int i = 0; i < interactibleObjects.Count; i++) { selectedObject = interactibleObjects[i].GetComponent <NeuroTag>(); OnTriggerPosition(availablePositions[i]); } // Disactivate the positions. SetPositionsActive(false); }
private void Awake() { // Find the animator component on this GameObject instance. animator = GetComponent <Animator>(); if (neuroTag == null) { // Find the NeuroTag component in parents neuroTag = GetComponentInParent <NeuroTag>(); } if (neuroTag != null) { neuroTag.onConfidenceChanged.AddListener(OnConfidenceUpdated); } }
/// <summary> /// Called when a user focus on an object to cut it. /// </summary> /// <param name="neuroTag">The focused object</param> public void OnTriggerObject(NeuroTag neuroTag) { // Store the object. selectedObject = neuroTag; // Activate the zones so the user can paste the cut object. SetPositionsActive(true); // Make the object disappear by scaling it smoothly to zero. StartCoroutine(SmoothScale(false, selectedObject.transform)); // Disactive all the objects NeuroTags. foreach (var c in interactibleObjects) { c.GetComponent <NeuroTag>().enabled = false; } }
/// <summary> /// Called when used focus on a zone, to paste the object he just cut. /// </summary> /// <param name="zone">The focused zone</param> public void OnTriggerPosition(PasteContainer zone) { // If we did not cut an object, leave the function. if (selectedObject == null) { return; } // Remove from old position. for (int i = 0; i < availablePositions.Count; i++) { if (availablePositions[i].containedGameObject == selectedObject.gameObject) { availablePositions[i].OnChangeContent(null); break; } } // Link the object to the chosen zone. zone.OnChangeContent(selectedObject.gameObject); // Disactivate all the zones. SetPositionsActive(false); // Make the pasted object reappear smoothly by scaling it up. StartCoroutine(SmoothScale(true, selectedObject.transform)); // Active all the objects neurotags foreach (var c in interactibleObjects) { NeuroTag tag = c.GetComponent <NeuroTag>(); if (tag != selectedObject) { tag.enabled = true; } } // Active the NeuroTag on the pasted object after a few second. // If it is reactivated directly, it can happen than the user focus on it and trigger it too quickly. StartCoroutine(DelayedActivation(selectedObject)); selectedObject = null; }
private void Awake() { if (neuroTag == null) { // Find the component in parents. neuroTag = GetComponentInParent <NeuroTag>(); } if (neuroTag != null) { neuroTag.onStimulationStateUpdated.AddListener(OnStimulationStateUpdated); neuroTag.onBecameActivated.AddListener(OnNeuroTagActivationChanged); neuroTag.onBecameDeactivated.AddListener(OnNeuroTagActivationChanged); } // Force to create an instance of the given material. material = new Material(material); SetMaterials(); }
/// <summary> /// Active the tag passed in parameters after a fixed delay. /// </summary> /// <param name="tag">The tag to activate.</param> private IEnumerator DelayedActivation(NeuroTag tag) { yield return(new WaitForSeconds(2f)); tag.enabled = true; }
/// <summary> /// When a trial is over, warn the monoTargetStep /// </summary> /// <param name="tag">The NeuroTag used during the trial which just ends.</param> public override IEnumerator OnEndCalibrating(NeuroTag tag) { yield return(monoTargetStep.StartCoroutine(monoTargetStep.OnTrialOver(tag))); }
/// <summary> /// Initialization of the NeuroTags at the very start of the calibration. /// </summary> /// <param name="tag">The NeuroTag to initialize.</param> public override void OnInitialize(NeuroTag tag) { }
public override IEnumerator OnEndCalibrating(NeuroTag tag) { CalibrationUIManager.Instance.AdvanceTagCounter(); yield break; }
public override IEnumerator OnStartCalibrating(NeuroTag tag) { CalibrationUIManager.Instance.TagCounterAnimate(); yield break; }