fixed cardboard and started data entry

This commit is contained in:
Chris Midkiff
2018-10-30 19:07:29 -04:00
parent fdaf801736
commit 499f1e4850
3 changed files with 568 additions and 1 deletions

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
public class ExperimentController : MonoBehaviour {
@@ -11,6 +13,8 @@ public class ExperimentController : MonoBehaviour {
int trialDotIndex;
Participant participant;
List<GameObject> dots = new List<GameObject>();
Stopwatch stopwatch = new Stopwatch();
GameObject playerCamera;
// Use this for initialization
void Start () {
//FOR THE LOVE OF GOD FUCKING DELETE THIS, SERIOUSLY CHRIS DON'T YOU DARE FORGET
@@ -20,6 +24,7 @@ public class ExperimentController : MonoBehaviour {
UnityEngine.Debug.Log(decodedText);
participant = new Participant(decodedText);
startDot = GameObject.Find("StartButton");
playerCamera = GameObject.FindGameObjectsWithTag("MainCamera")[0];
trialIndex = 0;
trialDotIndex = 0;
foreach (GameObject go in GameObject.FindGameObjectsWithTag("Dot"))
@@ -42,6 +47,17 @@ public class ExperimentController : MonoBehaviour {
public void NextDot()
{
if (stopwatch.IsRunning)
{
stopwatch.Stop();
double time = stopwatch.Elapsed.TotalSeconds;
stopwatch.Reset();
}
else
{
stopwatch.Start();
}
nextDot = FindDot(participant.trials[trialIndex][trialDotIndex]);
trialDotIndex++;
Show(nextDot);
@@ -52,9 +68,36 @@ public class ExperimentController : MonoBehaviour {
public void BackToStart()
{
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;
Hide(nextDot);
Show(startDot);
}
public void CardboardWrapper(GameObject go, PointerEventData eventData)
{
UnityEngine.Debug.Log(eventData.pointerPressRaycast.worldPosition);
if (go != null)
{
UnityEngine.Debug.Log(go.name);
if (go.name == "StartButton")
{
NextDot();
}
else
{
BackToStart();
}
}
else
{
UnityEngine.Debug.Log("Missed");
}
}
// Update is called once per frame