void OnEnable() { if (UseGlobalPath) { dataPath = VRsqrGlobalSettings.DataPrePath; subjectsStr = VRsqrGlobalSettings.SubjectsStr; } string fullSubjectsPath = dataPath + @"\" + subjectsStr; fullFileName = fullSubjectsPath + @"\" + eventName + ".txt"; // "_" + DateTime.Now.ToString("s") + ".txt"; Directory.CreateDirectory(fullSubjectsPath); VRsqr_EventsManager.StartListening(eventName, dataEventHandler); dataLines = new List <List <string> >(); VRsqr_InputKeyboard.AddKeyListener(KeyCode.S, toggleRecording, null, "Toggle recording"); int timeMs = DateTime.Now.Hour * 60 * 60 * 1000 + DateTime.Now.Minute * 60 * 1000 + DateTime.Now.Second * 1000 + DateTime.Now.Millisecond; //(float)ts.TotalMilliseconds; initTimeHeader = "Start time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture) + "\t" + timeMs; DataFieldNames.Add("[EventName]"); numFields++; DataFieldNames.Add("[TimeStampOUT]"); numFields++; DataFieldNames.Add("[TimeStampIN]"); numFields++; }
void Awake() { //Check if instance already exists if (!instance) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Debug.LogError("To handle keyboard events there must be exactly one active VRsqr_InputKeyboard script on a GameObject in your scene."); //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } //Sets this to not be destroyed when reloading scene //DontDestroyOnLoad(gameObject); // initialize the LUT with the keys pre-set in the inspector for (int ind = 0; ind < instance.keyEventMap.Count; ind++) { KeyEventMapping keyEvent = instance.keyEventMap[ind]; AddKeyToEventIndDict(keyEvent.keyCode, ind); } }
// Use this for initialization void Start() { cameraPivotObj = this.gameObject; // GameObject.FindWithTag("CameraPivot"); mainCamera = Camera.main; mainCamera.transform.SetParent(cameraPivotObj.transform); //transform.SetParent(cameraPivotObj.transform); this._XForm_Camera = mainCamera.transform; //this.transform; this._XForm_Parent = mainCamera.transform.parent; //this.transform.parent; VRsqr_InputKeyboard.AddKeyListener(ToggleCameraOrbitKey, toggleCamera, null, "Toggle camera-motion"); }