Skip to content
Snippets Groups Projects
Commit 8685c2dd authored by Unknown's avatar Unknown
Browse files

Add Recording for Questions

parent 43b044dd
Branches
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ namespace RockVR.Video
// Check if can start a capture session.
if (!isCaptureAudio && videoCaptures.Length == 0)
{
Debug.LogError(
Debug.LogWarning(
"[VideoCaptureCtrl::StartCapture] StartCapture called " +
"but no attached VideoRecorder or AudioRecorder were found!"
);
......
......@@ -54,7 +54,7 @@ public class EyeTrackingCSV_Recorder : MonoBehaviour
{
//Create File Name and Path where the logged Data should be Saved
dateTimeFileName = DateTime.Now.ToString("MM/dd/yyyy hh-mm tt");
dateTimeFileName = "EyeTracking-" + DateTime.Now.ToString("MM/dd/yyyy hh-mm tt");
dateTimeFileName = dateTimeFileName.Replace("/", "-");
FilePath = Application.dataPath;
FilePath = FilePath + "/Data";
......@@ -76,7 +76,7 @@ public class EyeTrackingCSV_Recorder : MonoBehaviour
if (counter == 0)
{
//Header at top of CSV
await sw.WriteLineAsync("UnixTimeStamp;Time since GameStart;Origin V3(x,y,z);Direction V3(x,y,z);GazeRay isValid;isLeftEyeBlinking;isRightEyeBlinking;ScreenPositionfromWorldspace(pixelWidth, pixelHeight, WorldUnitsfromCamera);TriggerState;BallPosition(x,y,z);BallLockedonTarget;GazeHitPoint;Gaze to Target Distance; Ball to Target Distance");
await sw.WriteLineAsync("UnixTimeStamp;Time since GameStart;Origin V3 X;Y;Z;Direction V3 X;Y;Z;GazeRay isValid;isLeftEyeBlinking;isRightEyeBlinking;ScreenPositionfromWorldspace pixelWidth;pixelHeight;WorldUnitsfromCamera;TriggerState;BallPositionX;Y;Z;BallLockedonTarget;GazeHitPoint;Gaze to Target Distance; Ball to Target Distance");
await sw.WriteLineAsync("SubjectID: " + RecordingController.Instance.SubjectID.ToString() + ";" + "ExperimentName: " + RecordingController.Instance.ExperimentName.ToString());
counter += 1;
}
......
......@@ -6,9 +6,12 @@ using UnityEngine;
public class GameManager : MonoBehaviour
{
[Record("SubjectID")]
public int SubjectID; //Field to enter SUbj ID
public String ExpName;
public enum Group { A, B};
[Record("Group")]
public Group group;
public enum Hand { LeftHand, RightHand }; //select Hand that user is using
public Hand hand;
......@@ -27,6 +30,7 @@ public class GameManager : MonoBehaviour
End
}
[Record("GameState")]
public GameState _currentState;
......@@ -40,23 +44,29 @@ public class GameManager : MonoBehaviour
public enum Condition { Motor, Gaze, Motor2Gaze, Gaze2Motor, BullsEye2Motor, Motor2BullsEye }; //Options to select Condition that shall be Played in Unity
[Record("Condition")]
public Condition condition;
//Debug Points shall be displayed or not?
[Record("ThrowCounter")]
public int ThrowCounter;
public bool first;
[Record("ActiveTargetNr")]
public int ActiveTargetNr;
public bool ActGame;
public bool finishedFirstCond;
private int Points;
[Record("Points")]
public int Points;
private string SysTimestampGamestart;
private string GameTimestampstart;
private string GameTimestampEnd;
[Record("SysTimestampGamestart")]
public string SysTimestampGamestart;
[Record("GameTimestampstart")]
public string GameTimestampstart;
[Record("GameTimestampEnd")]
public string GameTimestampEnd;
private string SysTimestampGameEnd;
public Material BWMaterial;
......@@ -128,6 +138,7 @@ public class GameManager : MonoBehaviour
}
Debug.Log("Finished Calibration");
_currentState = GameState.AfterEyeCalibration;
RecordingController.Instance.StartRecording();
ContinueStudy();
break;
case GameState.AfterEyeCalibration:
......@@ -222,6 +233,21 @@ public class GameManager : MonoBehaviour
BallHandler.instance.ForceBallReset(Ball);
}
if (Input.GetKeyDown(KeyCode.Alpha1))
{
var btn = FindObjectsOfType<ScaleButton>();
if(btn.Length > 0)
QuestionnaireUIHandler.instance.ButtonSelected(btn[UnityEngine.Random.Range(0, btn.Length)]);
}
if (Input.GetKeyDown(KeyCode.Alpha2))
{
QuestionnaireUIHandler.instance.ConfirmButtonSelected();
}
// if (ThrowCounter > (ThrowsInExperimentCondition-1) && ActGame == true) //Automatically end Game after desired number of throws have been reached
// {
......
......@@ -19,10 +19,12 @@ public class MainStudy_Recorder : MonoBehaviour
//string FilePath;
public List<string> EyeTrackingDataBuffer = new List<string>();
Vector3 rayOrigin = new Vector3();
Vector3 rayDirection = new Vector3();
Vector3 screenPosition = new Vector3();
[Record("rayOrigin")]
public Vector3 rayOrigin = new Vector3();
[Record("rayDirection")]
public Vector3 rayDirection = new Vector3();
[Record("screenPosition")]
public Vector3 screenPosition = new Vector3();
public Camera cam;
......@@ -52,10 +54,11 @@ public class MainStudy_Recorder : MonoBehaviour
private void Start() //Initialize File Name and Path of Logging File.
{
dateTimeFileName = DateTime.Now.ToString("MM/dd/yyyy hh-mm tt");
dateTimeFileName = "Main-" + DateTime.Now.ToString("MM/dd/yyyy hh-mm tt");
dateTimeFileName = dateTimeFileName.Replace("/", "-");
FilePath = Application.dataPath;
FilePath = FilePath + "/Data/Main";
Directory.CreateDirectory(FilePath);
Debug.Log("The EyeTracking Data will be Saved @:" + FilePath);
}
......
......@@ -16,6 +16,8 @@ public class QuestionnaireManager : MonoBehaviour
public List<answer> AnswersduringTrial = new List<answer>();
public List<answer> AnswersFullQuestionnaire = new List<answer>();
private int QuestionID = 0;
private void Awake()
{
if (instance != null && instance != this)
......@@ -41,7 +43,7 @@ public class QuestionnaireManager : MonoBehaviour
public void logAnswer(string question, int answer)
{
RecordingController.Instance.Info.AddSetting($"{QuestionID++} - {question}", $"{answer}");
if (fullQuestionnaireActive)
{
AnswersFullQuestionnaire.Add(new answer(question, answer));
......
......@@ -22,7 +22,7 @@ public class RecordingController : MonoBehaviour
private List<GameObjectRecording> GameObjectRecordings;
private RecordingModel Model;
private RecordingInfo Info;
public RecordingInfo Info;
private RecordingStatus Status;
private VideoCaptureCtrl _videoCapture;
......@@ -142,7 +142,7 @@ public class RecordingController : MonoBehaviour
Status = RecordingStatus.Recording;
CaptureScreenshotForOverview();
_videoCapture.StartCapture();
//_videoCapture.StartCapture();
}
// Uses the screenshot camera to capture a screenshot
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment