Actually comment the code
This commit is contained in:
parent
c101d05ff1
commit
8508de23c1
@ -34,6 +34,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
UnityEngine.Debug.Log(platform);
|
||||
string response = "";
|
||||
UnityEngine.Debug.Log(Application.persistentDataPath);
|
||||
//Load Trial data from server
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
string endpoint = "http://<URL OF SERVER INSTANCE>" + platform;
|
||||
@ -45,6 +46,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
playerCamera = GameObject.FindGameObjectsWithTag("MainCamera")[0];
|
||||
trialIndex = 0;
|
||||
trialDotIndex = 0;
|
||||
//Hide all the non-start dots and the DONE text
|
||||
foreach (GameObject go in GameObject.FindGameObjectsWithTag("Dot"))
|
||||
{
|
||||
dots.Add(go);
|
||||
@ -67,6 +69,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
|
||||
public void NextDot()
|
||||
{
|
||||
//Stop the timer if it is running.
|
||||
if (stopwatch.IsRunning)
|
||||
{
|
||||
stopwatch.Stop();
|
||||
@ -74,8 +77,10 @@ public class ExperimentController : MonoBehaviour {
|
||||
stopwatch.Reset();
|
||||
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
|
||||
//double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
|
||||
//Save a sample
|
||||
SaveSample(angle, time, false);
|
||||
}
|
||||
//Advance to the next dot and make it visible, while hiding the start dot.
|
||||
if (trialDotIndex < participant.trials[trialIndex].Length)
|
||||
{
|
||||
|
||||
@ -84,10 +89,12 @@ public class ExperimentController : MonoBehaviour {
|
||||
Show(nextDot);
|
||||
Hide(startDot);
|
||||
}
|
||||
//Advance to the next trial
|
||||
else if(trialIndex < participant.trials.Length)
|
||||
{
|
||||
trialIndex++;
|
||||
trialDotIndex = 0;
|
||||
//Save data if we aren't in practice mode.
|
||||
if(participant.participantId != 9999) dataSet.SaveDataSet();
|
||||
dataSet.Samples.Clear();
|
||||
if (trialIndex < participant.trials.Length && participant.participantId != 9999)
|
||||
@ -104,6 +111,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
}
|
||||
else
|
||||
{
|
||||
//Save data if we aren't in practice mode.
|
||||
if (participant.participantId != 9999) dataSet.SaveDataSet();
|
||||
}
|
||||
stopwatch.Start();
|
||||
@ -111,6 +119,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
|
||||
}
|
||||
|
||||
//Hide current dot, Show start dot, and reset the timer.
|
||||
public void BackToStart()
|
||||
{
|
||||
stopwatch.Stop();
|
||||
@ -118,6 +127,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
stopwatch.Reset();
|
||||
double angle = Vector3.Angle(nextDot.transform.position, playerCamera.transform.position);
|
||||
//double distance = Vector3.Distance(nextDot.transform.position, startDot.transform.position);
|
||||
//Save a sample
|
||||
SaveSample(angle, time, true);
|
||||
Hide(nextDot);
|
||||
Show(startDot);
|
||||
@ -126,6 +136,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
|
||||
}
|
||||
|
||||
//Wrapper method to convert the Cardboard way of handling things to the Oculus one.
|
||||
public void CardboardWrapper(GameObject go, PointerEventData eventData)
|
||||
{
|
||||
UnityEngine.Debug.Log(eventData.pointerPressRaycast.worldPosition);
|
||||
@ -151,6 +162,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
{
|
||||
Sample sample = new Sample();
|
||||
sample.Angle = angle;
|
||||
//Fill in dot distances.
|
||||
if(nextDot.name.Contains("Short")){
|
||||
sample.Distance = 500;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ public class Participant
|
||||
public string[][] trials;
|
||||
public string inputMethod;
|
||||
public int participantId;
|
||||
|
||||
//Parse data from server.
|
||||
public Participant(string json)
|
||||
{
|
||||
JObject jObject = JObject.Parse(json);
|
||||
|
Loading…
Reference in New Issue
Block a user