public GameObject Instantiate_SMI()
    {
        try
        {
            Instantiate_Gaze_Cursor   = GameObject.Find("Instantiate_Gaze_Cursor").GetComponent <Toggle>().isOn;
            Enable_SMI_Notification   = GameObject.Find("Enable_SMI_Notification").GetComponent <Toggle>().isOn;
            Is_Simulation_Mode_Active = GameObject.Find("Is_Simulation_Mode_Active").GetComponent <Toggle>().isOn;
        }
        catch (System.Exception err)
        {
            Debug.LogError("Can't find canvas, " + err.Message);
            return(null);
        }
        SMI.SMIEyeTrackingUnity SMI_Component = SMI_Prefab.GetComponent <SMI.SMIEyeTrackingUnity>();
        SMI_Component.enableSMINotificationInVR = Enable_SMI_Notification;
        SMI_Component.isSimulationModeActive    = Is_Simulation_Mode_Active;
        Experiment_Ctrl ctrl = GetComponent <Experiment_Ctrl>();

        ctrl.user_name         = GameObject.Find("user_name").GetComponent <Text>().text;
        ctrl.sample_rate       = float.Parse(GameObject.Find("Sample_Rate").GetComponent <Text>().text);
        ctrl.stimulus_interval = float.Parse(GameObject.Find("Stimulus_Interval").GetComponent <Text>().text);
        ctrl.show_gaze_cursor  = true;
        GameObject SMI_Instance = GameObject.Instantiate(SMI_Prefab);

        SMI_Instance.GetComponent <Camera>().backgroundColor = Color.gray;

        return(SMI_Instance);
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        Experiment_Ctrl ctrl = (Experiment_Ctrl)target;

        serializedObject.Update();

        ctrl.SMI_Prefab        = (GameObject)EditorGUILayout.ObjectField("SMI_Prefab", ctrl.SMI_Prefab, typeof(GameObject), true);
        ctrl.sample_rate       = EditorGUILayout.FloatField("sample rate", ctrl.sample_rate);
        ctrl.stimulus_interval = EditorGUILayout.FloatField("stimulus interval", ctrl.stimulus_interval);
        ctrl.user_name         = EditorGUILayout.TextField("user name", ctrl.user_name);

        SerializedProperty usrTags = serializedObject.FindProperty("usrTags");

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(usrTags, true);
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }

        serializedObject.ApplyModifiedProperties();
    }
 /// <summary>
 /// Constructor
 ///     The datalogger should be constructed by Experiment_Ctrl
 /// </summary>
 /// <param name="ctrl"></param>
 public DataLogger(Experiment_Ctrl ctrl)
 {
     experiment_ctrl = ctrl;
 }