public override void onExperimentSessionBegin(object sender, ApollonEngine.EngineExperimentEventArgs arg) { // keep session alive this.Session = arg.Session; // switch to active profile switch (this.Session.settings.GetString("APOLLON_profile")) { // Agency And TBW case string param when param.Equals( ApollonEngine.GetEnumDescription(ProfileIDType.AgencyAndTBW), System.StringComparison.InvariantCultureIgnoreCase ): { UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonExperimentManager.onExperimentSessionBegin() : found APOLLON_profile setting value [AgencyAndTBW]" ); this.setActiveProfile(ProfileIDType.AgencyAndTBW); break; } // AgencyAndThresholdPerception case string param when param.Equals( ApollonEngine.GetEnumDescription(ProfileIDType.AgencyAndThresholdPerception), System.StringComparison.InvariantCultureIgnoreCase ): { UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonExperimentManager.onExperimentSessionBegin() : found APOLLON_profile setting value [AgencyAndThresholdPerception]" ); this.setActiveProfile(ProfileIDType.AgencyAndThresholdPerception); break; } // CAVIAR case string param when param.Equals( ApollonEngine.GetEnumDescription(ProfileIDType.CAVIAR), System.StringComparison.InvariantCultureIgnoreCase ): { UnityEngine.Debug.Log( "<color=blue>Info: </color> ApollonExperimentManager.onExperimentSessionBegin() : found APOLLON_profile setting value [CAVIAR]" ); this.setActiveProfile(ProfileIDType.CAVIAR); break; } default: { UnityEngine.Debug.LogError( "<color=red>Error: </color> ApollonExperimentManager.onExperimentSessionBegin() : could not determine APOLLON_profile setting value... check configuration file" ); return; } } /* switch() */ // call this.Profile.onExperimentSessionBegin(sender, arg); } /* onExperimentSessionBegin() */
protected override System.String getCurrentStatusInfo() { return( "[" + ApollonEngine.GetEnumDescription(this.ID) + "]\n" + ApollonEngine.GetEnumDescription(this.CurrentSettings.scenario_type) + " | " + UXF.Session.instance.CurrentTrial.settings.GetString("current_pattern") + " | " + this.positiveConditionCount + "(+)/" + this.negativeConditionCount + "(-)" ); } /* getCurrentStatusInfo() */
protected override UnityEngine.MonoBehaviour WrapBehaviour() { foreach (UnityEngine.MonoBehaviour behaviour in UnityEngine.Resources.FindObjectsOfTypeAll <ApollonMainMenuBehaviour>()) { if (behaviour.transform.name == ApollonEngine.GetEnumDescription(ApollonFrontendManager.FrontendIDType.MainMenu)) { return(behaviour); } } // log UnityEngine.Debug.LogWarning( "<color=Orange>Warning: </color> ApollonMainMenuBridge.WrapBehaviour() : could not find object of type ApollonMainMenuBehaviour from Unity." ); return(null); } /* WrapBehaviour() */
protected override UnityEngine.MonoBehaviour WrapBehaviour() { foreach (UnityEngine.MonoBehaviour behaviour in UnityEngine.Resources.FindObjectsOfTypeAll<ApollonVerticalAnchorableDockBehaviour>()) { if (behaviour.transform.name == ApollonEngine.GetEnumDescription(ApollonFrontendManager.FrontendIDType.GreenFrameGUI)) { return behaviour; } } // log UnityEngine.Debug.LogWarning( "<color=Orange>Warning: </color> ApollonGreenFrameGUIBridge.WrapBehaviour() : could not find object of type behaviour.ApollonGreenFrameGUIBehaviour from Unity." ); return null; } /* WrapBehaviour() */
} /* DoPhaseE() */ #endregion #region abstract implementation protected override System.String getCurrentStatusInfo() { return("[" + ApollonEngine.GetEnumDescription(this.ID) + "] : no active status"); } /* getCurrentStatusInfo() */
} /* onExperimentTrialBegin() */ public override async void onExperimentTrialEnd(object sender, ApollonEngine.EngineExperimentEventArgs arg) { // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialEnd() : begin" ); // write the randomized scenario/pattern/conditions(s) as result for convenience ApollonExperimentManager.Instance.Trial.result["scenario"] = ApollonEngine.GetEnumDescription(this.CurrentSettings.scenario_type); ApollonExperimentManager.Instance.Trial.result["pattern"] = ApollonExperimentManager.Instance.Trial.settings.GetString("current_pattern"); ApollonExperimentManager.Instance.Trial.result["active_condition"] = this.CurrentSettings.bIsActive.ToString(); ApollonExperimentManager.Instance.Trial.result["catch_try_condition"] = this.CurrentSettings.bIsTryCatch.ToString(); // write result ApollonExperimentManager.Instance.Trial.result["user_command"] = this.CurrentResults.user_command; ApollonExperimentManager.Instance.Trial.result["user_stim_host_timestamp"] = this.CurrentResults.user_stim_host_timestamp; ApollonExperimentManager.Instance.Trial.result["user_stim_unity_timestamp"] = this.CurrentResults.user_stim_unity_timestamp; ApollonExperimentManager.Instance.Trial.result["user_response_B"] = this.CurrentResults.user_response_B; ApollonExperimentManager.Instance.Trial.result["user_perception_B_host_timestamp"] = this.CurrentResults.user_perception_B_host_timestamp; ApollonExperimentManager.Instance.Trial.result["user_perception_B_unity_timestamp"] = this.CurrentResults.user_perception_B_unity_timestamp; ApollonExperimentManager.Instance.Trial.result["user_response_C"] = this.CurrentResults.user_response_C; ApollonExperimentManager.Instance.Trial.result["user_perception_C_host_timestamp"] = this.CurrentResults.user_perception_C_host_timestamp; ApollonExperimentManager.Instance.Trial.result["user_perception_C_unity_timestamp"] = this.CurrentResults.user_perception_C_unity_timestamp; // fade in await this.DoFadeIn(this._trial_fade_in_duration, false); // // send event to motion system backend // ( // backend.ApollonBackendManager.Instance.GetValidHandle( // backend.ApollonBackendManager.HandleIDType.ApollonMotionSystemPS6TM550Handle // ) as backend.handle.ApollonMotionSystemPS6TM550Handle // ).EndTrial(); // get active seat bridge gameplay.entity.ApollonActiveSeatEntityBridge seat_bridge = gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.ActiveSeatEntity ) as gameplay.entity.ApollonActiveSeatEntityBridge; // check if (seat_bridge == null) { // log UnityEngine.Debug.LogError( "<color=Red>Error: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialEnd() : Could not find corresponding gameplay bridge !" ); // fail return; } /* if() */ // get back to idle state seat_bridge.Dispatcher.RaiseIdle(); // base call base.onExperimentTrialEnd(sender, arg); // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialEnd() : end" ); } /* onExperimentTrialEnd() */
} /* onExperimentSessionEnd() */ public override async void onExperimentTrialBegin(object sender, ApollonEngine.EngineExperimentEventArgs arg) { // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialBegin() : begin" ); // // send event to motion system backend // ( // backend.ApollonBackendManager.Instance.GetValidHandle( // backend.ApollonBackendManager.HandleIDType.ApollonMotionSystemPS6TM550Handle // ) as backend.handle.ApollonMotionSystemPS6TM550Handle // ).BeginTrial(); // local int currentIdx = ApollonExperimentManager.Instance.Session.currentTrialNum - 1; // activate the active seat entity gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.ActiveSeatEntity); // inactivate all visual cues through LINQ request var we_behaviour = gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.WorldElement ).Behaviour as gameplay.element.ApollonWorldElementBehaviour; foreach (var vc_ref in we_behaviour.References.Where(kvp => kvp.Key.Contains("VCTag_")).Select(kvp => kvp.Value)) { vc_ref.SetActive(false); } // current scenario switch (arg.Trial.settings.GetString("scenario_name")) { case "visual-only": { we_behaviour.References["VCTag_Fan"].SetActive(true); this.CurrentSettings.scenario_type = Settings.ScenarioIDType.VisualOnly; // transit to corresponding entity state ( gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.ActiveSeatEntity ) as gameplay.entity.ApollonActiveSeatEntityBridge ).Dispatcher.RaiseVisualOnly(); break; } case "vestibular-only": { we_behaviour.References["VCTag_Spot"].SetActive(true); this.CurrentSettings.scenario_type = Settings.ScenarioIDType.VestibularOnly; // transit to corresponding entity state ( gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.ActiveSeatEntity ) as gameplay.entity.ApollonActiveSeatEntityBridge ).Dispatcher.RaiseVestibularOnly(); break; } case "visuo-vestibular": { we_behaviour.References["VCTag_Fan"].SetActive(true); this.CurrentSettings.scenario_type = Settings.ScenarioIDType.VisuoVestibular; // transit to corresponding entity state ( gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.ActiveSeatEntity ) as gameplay.entity.ApollonActiveSeatEntityBridge ).Dispatcher.RaiseVisuoVestibular(); break; } default: { this.CurrentSettings.scenario_type = Settings.ScenarioIDType.Undefined; break; } } /* switch() */ // extract trial settings this.CurrentSettings.bIsTryCatch = arg.Trial.settings.GetBool("is_catch_try_condition"); this.CurrentSettings.bIsActive = arg.Trial.settings.GetBool("is_active_condition"); this.CurrentSettings.phase_A_duration = arg.Trial.settings.GetFloat("phase_A_duration_ms"); this.CurrentSettings.phase_B_begin_stim_timeout_lower_bound = arg.Trial.settings.GetFloatList("phase_B_begin_stim_timeout_ms")[0]; this.CurrentSettings.phase_B_begin_stim_timeout_upper_bound = arg.Trial.settings.GetFloatList("phase_B_begin_stim_timeout_ms")[1]; this.CurrentSettings.phase_C_stim_duration = arg.Trial.settings.GetFloat("phase_C_stim_duration_ms"); this.CurrentSettings.phase_C_total_duration = arg.Trial.settings.GetFloat("phase_C_total_duration_ms"); this.CurrentSettings.phase_C_angular_displacement_limiter = arg.Trial.settings.GetFloatList("phase_C_angular_displacement_limiter_deg").ToArray(); this.CurrentSettings.phase_C_angular_acceleration_target = arg.Trial.settings.GetFloatList("phase_C_angular_acceleration_target_deg_per_s2").ToArray(); this.CurrentSettings.phase_C_angular_velocity_saturation_threshold = arg.Trial.settings.GetFloatList("phase_C_angular_velocity_saturation_threshold_deg_per_s").ToArray(); this.CurrentSettings.phase_C_angular_mandatory_axis = arg.Trial.settings.GetBoolList("phase_C_angular_mandatory_axis").ToArray(); this.CurrentSettings.phase_C_linear_displacement_limiter = arg.Trial.settings.GetFloatList("phase_C_linear_displacement_limiter_m").ToArray(); this.CurrentSettings.phase_C_linear_acceleration_target = arg.Trial.settings.GetFloatList("phase_C_linear_acceleration_target_m_per_s2").ToArray(); this.CurrentSettings.phase_C_linear_velocity_saturation_threshold = arg.Trial.settings.GetFloatList("phase_C_linear_velocity_saturation_threshold_m_per_s").ToArray(); this.CurrentSettings.phase_C_linear_mandatory_axis = arg.Trial.settings.GetBoolList("phase_C_linear_mandatory_axis").ToArray(); this.CurrentSettings.phase_D_duration = arg.Trial.settings.GetFloat("phase_D_duration_ms"); // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialBegin() : found current settings with pattern[" + arg.Trial.settings.GetString("current_pattern") + "]" + "\n - bIsTryCatch : " + this.CurrentSettings.bIsTryCatch + "\n - bIsActive : " + this.CurrentSettings.bIsActive + "\n - scenario_name : " + ApollonEngine.GetEnumDescription(this.CurrentSettings.scenario_type) + "\n - phase_A_duration : " + this.CurrentSettings.phase_A_duration + "\n - phase_B_begin_stim_timeout_lower_bound : " + this.CurrentSettings.phase_B_begin_stim_timeout_lower_bound + "\n - phase_B_begin_stim_timeout_upper_bound : " + this.CurrentSettings.phase_B_begin_stim_timeout_upper_bound + "\n - phase_C_stim_duration : " + this.CurrentSettings.phase_C_stim_duration + "\n - phase_C_total_duration : " + this.CurrentSettings.phase_C_total_duration + "\n - phase_C_angular_displacement_limiter : [" + System.String.Join(",", this.CurrentSettings.phase_C_angular_displacement_limiter) + "]" + "\n - phase_C_angular_acceleration_target : [" + System.String.Join(",", this.CurrentSettings.phase_C_angular_acceleration_target) + "]" + "\n - phase_C_angular_velocity_saturation_threshold : [" + System.String.Join(",", this.CurrentSettings.phase_C_angular_velocity_saturation_threshold) + "]" + "\n - phase_C_angular_mandatory_axis : [" + System.String.Join(",", this.CurrentSettings.phase_C_angular_mandatory_axis) + "]" + "\n - phase_C_linear_displacement_limiter : [" + System.String.Join(",", this.CurrentSettings.phase_C_linear_displacement_limiter) + "]" + "\n - phase_C_linear_acceleration_target : [" + System.String.Join(",", this.CurrentSettings.phase_C_linear_acceleration_target) + "]" + "\n - phase_C_linear_velocity_saturation_threshold : [" + System.String.Join(",", this.CurrentSettings.phase_C_linear_velocity_saturation_threshold) + "]" + "\n - phase_C_linear_mandatory_axis : [" + System.String.Join(",", this.CurrentSettings.phase_C_linear_mandatory_axis) + "]" + "\n - phase_D_duration : " + this.CurrentSettings.phase_D_duration ); // activate world element & contriol system gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.WorldElement); gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.AgencyAndThresholdPerceptionControl); // base call base.onExperimentTrialBegin(sender, arg); // fade out await this.DoFadeOut(this._trial_fade_out_duration, false); // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonAgencyAndThresholdPerceptionProfile.onExperimentTrialBegin() : end " + UnityEngine.Time.fixedTime ); // build protocol await this.DoRunProtocol( async() => { await this.SetState(new phase.ApollonAgencyAndThresholdPerceptionPhase0(this)); }, async() => { await this.SetState(new phase.ApollonAgencyAndThresholdPerceptionPhaseA(this)); }, async() => { await this.SetState(new phase.ApollonAgencyAndThresholdPerceptionPhaseB(this)); }, async() => { await this.SetState(new phase.ApollonAgencyAndThresholdPerceptionPhaseC(this)); }, async() => { await this.SetState(new phase.ApollonAgencyAndThresholdPerceptionPhaseD(this)); }, async() => { await this.SetState(null); } ); } /* onExperimentTrialBegin() */
} /* onExperimentSessionBegin() */ public override async void onExperimentTrialBegin(object sender, ApollonEngine.EngineExperimentEventArgs arg) { // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : begin" ); // temporary string string log = ""; // extract current settings this.CurrentSettings.phase_B_distance = arg.Trial.settings.GetFloat("phase_B_distance_meter"); this.CurrentSettings.phase_D_distance = arg.Trial.settings.GetFloat("phase_D_distance_meter"); this.CurrentSettings.phase_E_distance = arg.Trial.settings.GetFloat("phase_E_distance_meter"); this.CurrentSettings.phase_F_duration = arg.Trial.settings.GetFloat("phase_F_duration_ms"); // log log += "\n - phase_B_distance : " + this.CurrentSettings.phase_B_distance + "\n - phase_D_distance : " + this.CurrentSettings.phase_D_distance + "\n - phase_E_distance : " + this.CurrentSettings.phase_E_distance + "\n - phase_F_duration : " + this.CurrentSettings.phase_F_duration; // clean arrays this.CurrentSettings.phase_C_settings.Clear(); this.CurrentResults.phase_C_results.Clear(); this.CurrentResults.phase_D_results.Clear(); // instantiate loopable phase ([C -> D] -> [C -> D] -> ...) for (ushort idx = 0; idx < ApollonCAVIARProfile.InternalPhaseLoopCount; ++idx) { // get current visual cue identifier var cue_list = new System.Collections.Generic.List <Settings.VisualCueIDType>(); foreach (var cue in arg.Trial.settings.GetStringList("phase_C" + idx + "_visual_cue_type_string")) { switch (cue) { // 3D object - cube case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC3DCube), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC3DCube); break; } // 3D object - tetrahedre case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC3DTetrahedre), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC3DTetrahedre); break; } // 3D object - default case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC3D), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC3D); break; } // 2D object - grid case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC2DGrid), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC2DGrid); break; } // 2D object - circle case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC2DCircle), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC2DCircle); break; } // 2D object - square case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC2DSquare), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC2DSquare); break; } // 2D object - default case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VC2D), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VC2D); break; } // Controle case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.Control), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.Control); break; } // Controle case string param when param.Equals( ApollonEngine.GetEnumDescription(Settings.VisualCueIDType.VCHUDRadiosonde), System.StringComparison.InvariantCultureIgnoreCase ): { cue_list.Add(Settings.VisualCueIDType.VCHUDRadiosonde); break; } default: { // log error UnityEngine.Debug.LogError( "<color=Red>Error: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : found invalid string value[" + cue + "] for setting[" + "phase_C" + idx + "_visual_cue_type_string" + "]" ); break; } } /* switch() */ } /* foreach() */ // instantiate settings & result this.CurrentSettings.phase_C_settings.Add( new Settings.PhaseCSettings() { visual_cue_type = cue_list, total_distance = arg.Trial.settings.GetFloat("phase_C" + idx + "_total_distance_meter"), target_velocity = arg.Trial.settings.GetFloat("phase_C" + idx + "_target_velocity_meter_per_s"), stim_begin_distance = arg.Trial.settings.GetFloat("phase_C" + idx + "_stim_begin_distance_meter"), stim_acceleration = arg.Trial.settings.GetFloat("phase_C" + idx + "_stim_acceleration_meter_per_s2"), stim_velocity = arg.Trial.settings.GetFloat("phase_C" + idx + "_stim_velocity_meter_per_s"), fog_start_distance = arg.Trial.settings.GetFloat("phase_C" + idx + "_fog_start_distance_meter"), fog_end_distance = arg.Trial.settings.GetFloat("phase_C" + idx + "_fog_end_distance_meter") } ); this.CurrentResults.phase_C_results.Add(new Results.PhaseCResults()); this.CurrentResults.phase_D_results.Add(new Results.PhaseDResults()); // log log += "\n - [C" + idx + "] visual_cue_type : " + string.Join( ",", this.CurrentSettings.phase_C_settings[idx].visual_cue_type.ConvertAll( new System.Converter <Settings.VisualCueIDType, string>(ApollonEngine.GetEnumDescription) ) ) + "\n - [C" + idx + "] total_distance : " + this.CurrentSettings.phase_C_settings[idx].total_distance + "\n - [C" + idx + "] target_velocity : " + this.CurrentSettings.phase_C_settings[idx].target_velocity + "\n - [C" + idx + "] stim_begin_distance : " + this.CurrentSettings.phase_C_settings[idx].stim_begin_distance + "\n - [C" + idx + "] stim_acceleration : " + this.CurrentSettings.phase_C_settings[idx].stim_acceleration + "\n - [C" + idx + "] stim_velocity : " + this.CurrentSettings.phase_C_settings[idx].stim_velocity + "\n - [C" + idx + "] fog_start_distance : " + this.CurrentSettings.phase_C_settings[idx].fog_start_distance + "\n - [C" + idx + "] fog_end_distance : " + this.CurrentSettings.phase_C_settings[idx].fog_end_distance; } /* for() */ // pop last phase_D_results item this.CurrentResults.phase_D_results.RemoveAt(this.CurrentResults.phase_D_results.Count - 1); // log the final result UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : found current settings " + log ); // write the randomized pattern as result for convenience arg.Trial.result["pattern"] = arg.Trial.settings.GetString("current_pattern"); // activate world, CAVIAR entity, Radiosonde sensor, HOTAS Throttle gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.WorldElement); gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.FogElement); // activate current database var db_str = arg.Trial.settings.GetString("database_name"); var db_origin_position = arg.Trial.settings.GetFloatList("database_origin_position"); var db_origin_orientation = arg.Trial.settings.GetFloatList("database_origin_orientation"); // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : found settings database name [" + db_str + "], try finding the only associated game object tag" ); // get bridge var we_behaviour = gameplay.ApollonGameplayManager.Instance.getBridge( gameplay.ApollonGameplayManager.GameplayIDType.WorldElement ).Behaviour as gameplay.element.ApollonWorldElementBehaviour; // LINQ foreach (var db_ref in we_behaviour.References.Where(kvp => kvp.Key.Contains("DBTag_")).Select(kvp => kvp.Value)) { // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : referenced gameObject[" + db_ref.name + "], inactivating" ); // inactivate all first db_ref.SetActive(false); } // then activate only requested if (we_behaviour.References[db_str] != null) { // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : found game object, activating" ); // mark as active we_behaviour.References[db_str].SetActive(true); // translate to our new origin we_behaviour.References[db_str].transform.Translate( -1.0f * new UnityEngine.Vector3( db_origin_position[0], db_origin_position[1], db_origin_position[2] ) ); // apply rotation from our new world space origin we_behaviour.References[db_str].transform.Rotate( new UnityEngine.Vector3( db_origin_orientation[0], db_origin_orientation[1], db_origin_orientation[2] ), UnityEngine.Space.World ); } else { // log UnityEngine.Debug.LogError( "<color=Red>Error: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : could not find requested game object by name, error..." ); } /* if() */ // finally activate raycasting element gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.CAVIAREntity); gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.RadioSondeSensor); gameplay.ApollonGameplayManager.Instance.setActive(gameplay.ApollonGameplayManager.GameplayIDType.CAVIARControl); // base call base.onExperimentTrialBegin(sender, arg); // fade out await this.DoFadeOut(this._trial_fade_out_duration, false); // log UnityEngine.Debug.Log( "<color=Blue>Info: </color> ApollonCAVIARProfile.onExperimentTrialBegin() : end" ); // build protocol await this.DoRunProtocol( async() => { await this.SetState(new phase.ApollonCAVIARPhaseA(this)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseB(this)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseC(this, 0)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseD(this, 0, 1)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseC(this, 1)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseD(this, 1, 2)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseC(this, 2)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseD(this, 2, 3)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseC(this, 3)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseE(this)); }, async() => { await this.SetState(new phase.ApollonCAVIARPhaseF(this)); }, async() => { await this.SetState(null); } ); } /* onExperimentTrialBegin() */