we done with data entry BITCH!

This commit is contained in:
Chris Midkiff 2018-11-28 19:09:50 -05:00
parent a0dfede3ac
commit 5c9c0f5214
2 changed files with 66 additions and 15 deletions

View File

@ -1,4 +1,5 @@
using System;
using Assets.Scripts;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
@ -15,8 +16,20 @@ public class ExperimentController : MonoBehaviour {
List<GameObject> dots = new List<GameObject>();
Stopwatch stopwatch = new Stopwatch();
GameObject playerCamera;
DataSet dataSet = new DataSet();
string platform;
// Use this for initialization
void Start () {
#if UNITY_ANDROID
platform = "cardboard";
#endif
#if UNITY_EDITOR
platform = "mouse";
#endif
#if UNITY_STANDALONE_WIN
platform = "rift";
#endif
//FOR THE LOVE OF GOD FUCKING DELETE THIS, SERIOUSLY CHRIS DON'T YOU DARE FORGET
string fuck = "ewoidHJpYWxzIiA6IFsKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXSwKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXSwKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXQpdLAoicGFydGljaXBhbnRJZCIgOiAxLAoiaW5wdXRNZXRob2QiIDogImNhcmRib2FyZCIKfQo=";
byte[] decodedBytes = Convert.FromBase64String(fuck);
@ -52,16 +65,34 @@ public class ExperimentController : MonoBehaviour {
stopwatch.Stop();
double time = stopwatch.Elapsed.TotalSeconds;
stopwatch.Reset();
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
SaveSample(angle, distance, time, false);
}
else
if (trialDotIndex < participant.trials[trialIndex].Length)
{
stopwatch.Start();
}
nextDot = FindDot(participant.trials[trialIndex][trialDotIndex]);
trialDotIndex++;
Show(nextDot);
Hide(startDot);
}
else if(trialIndex < participant.trials.Length)
{
// NEXT TRIAL SHIT
trialIndex++;
trialDotIndex = 0;
dataSet.SaveDataSet();
dataSet.Samples.Clear();
nextDot = FindDot(participant.trials[trialIndex][trialDotIndex]);
Show(nextDot);
Hide(startDot);
}
else
{
dataSet.SaveDataSet();
}
stopwatch.Start();
}
@ -71,11 +102,12 @@ public class ExperimentController : MonoBehaviour {
stopwatch.Stop();
double time = stopwatch.Elapsed.TotalSeconds;
stopwatch.Reset();
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
double arcDistance = angle * (float)(Math.PI / 180) * 10;
double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
SaveSample(angle, distance, time, true);
Hide(nextDot);
Show(startDot);
stopwatch.Start();
}
@ -101,9 +133,21 @@ public class ExperimentController : MonoBehaviour {
}
}
// Update is called once per frame
void Update () {
void SaveSample(double angle, double distance, double time, bool direction)
{
Sample sample = new Sample();
sample.Angle = angle;
sample.Distance = distance;
sample.Time = time;
sample.Direction = direction;
sample.DotName = nextDot.name;
sample.DotIndex = trialDotIndex;
sample.TrialIndex = trialIndex + 1;
sample.ParticipantID = participant.participantId;
sample.Platform = platform;
TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1);
sample.Timestamp = (long)t.TotalMilliseconds;
dataSet.Samples.Add(sample);
}
GameObject FindDot(string name)
@ -114,4 +158,11 @@ public class ExperimentController : MonoBehaviour {
}
return null;
}
// Update is called once per frame
void Update () {
}
}

View File

@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: Defuckulate
productName: FittsVR
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}