Added participant and other stuff
This commit is contained in:
12
Assets/Scripts/ChangeScene.cs
Normal file
12
Assets/Scripts/ChangeScene.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ChangeScene : MonoBehaviour {
|
||||
|
||||
public void ChangeScenes(string sceneToLoad)
|
||||
{
|
||||
SceneManager.LoadScene(sceneToLoad);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9213a906c4bf7e743a6a93cd31e56ae8
|
||||
guid: 7b3dabea2d4de5541a3a55e989f8793f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
64
Assets/Scripts/ExperimentController.cs
Normal file
64
Assets/Scripts/ExperimentController.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class ExperimentController : MonoBehaviour {
|
||||
|
||||
GameObject startDot;
|
||||
GameObject nextDot;
|
||||
int trialIndex;
|
||||
int trialDotIndex;
|
||||
Participant participant;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
//FOR THE LOVE OF GOD FUCKING DELETE THIS, SERIOUSLY CHRIS DON'T YOU DARE FORGET
|
||||
string fuck = "ewoidHJpYWxzIiA6IFsKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXSwKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXSwKICBbIkxlZnRMb25nIiwiUmlnaHRNZWRpdW0iLCJMZWZ0U2hvcnQiLCJVcE1lZGl1bSIsIlVwTG9uZyIsIlJpZ2h0U2hvcnQiXSwKICBbIlVwU2hvcnQiLCJSaWdodExvbmciLCJMZWZ0TWVkaXVtIiwiUmlnaHRNZWRpdW0iLCJMZWZ0TG9uZyIsIlVwTG9uZyJdLAogIFsiUmlnaHRTaG9ydCIsIlVwTWVkaXVtIiwiTGVmdE1lZGl1bSIsIkxlZnRTaG9ydCIsIlJpZ2h0TG9uZyIsIlVwU2hvcnQiXQpdLAoicGFydGljaXBhbnRJZCIgOiAxLAoiaW5wdXRNZXRob2QiIDogImNhcmRib2FyZCIKfQo=";
|
||||
byte[] decodedBytes = Convert.FromBase64String(fuck);
|
||||
string decodedText = Encoding.UTF8.GetString(decodedBytes);
|
||||
UnityEngine.Debug.Log(decodedText);
|
||||
participant = new Participant(decodedText);
|
||||
startDot = GameObject.Find("StartButton");
|
||||
trialIndex = 0;
|
||||
trialDotIndex = 0;
|
||||
foreach (GameObject go in GameObject.FindGameObjectsWithTag("Dot"))
|
||||
{
|
||||
Hide(go);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void Hide(GameObject dot)
|
||||
{
|
||||
dot.GetComponent<SpriteRenderer>().enabled = false;
|
||||
//dot.GetComponent<CircleCollider2D>().enabled = false;
|
||||
}
|
||||
|
||||
void Show(GameObject dot)
|
||||
{
|
||||
dot.GetComponent<SpriteRenderer>().enabled = true;
|
||||
//dot.GetComponent<CircleCollider2D>(). = true;
|
||||
}
|
||||
|
||||
public void NextDot()
|
||||
{
|
||||
nextDot = GameObject.Find(participant.trials[trialIndex][trialDotIndex]);
|
||||
trialDotIndex++;
|
||||
Show(nextDot);
|
||||
Hide(startDot);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void BackToStart()
|
||||
{
|
||||
Hide(nextDot);
|
||||
//nextDot = GameObject.Find(participant.trials[trialIndex][trialDotIndex]);
|
||||
Show(startDot);
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/ExperimentController.cs.meta
Normal file
11
Assets/Scripts/ExperimentController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5ec14cccdc625049a7deb31b2b0aa76
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/Scripts/Participant.cs
Normal file
28
Assets/Scripts/Participant.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
public class Participant
|
||||
{
|
||||
public string[][] trials;
|
||||
public string inputMethod;
|
||||
public int participantId;
|
||||
|
||||
public Participant(string json)
|
||||
{
|
||||
JObject jObject = JObject.Parse(json);
|
||||
JArray jTrials = (JArray)jObject["trials"];
|
||||
this.trials = new string[jTrials.Count][];
|
||||
for (int i = 0;i<jTrials.Count;i++)
|
||||
{
|
||||
JArray ja = (JArray)jTrials[i];
|
||||
this.trials[i] = new string[ja.Count];
|
||||
for(int j = 0; j < ja.Count;j++)
|
||||
{
|
||||
this.trials[i][j] = ja[j].ToString();
|
||||
}
|
||||
}
|
||||
this.inputMethod = jObject["inputMethod"].ToString();
|
||||
this.participantId = int.Parse(jObject["participantId"].ToString());
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Participant.cs.meta
Normal file
11
Assets/Scripts/Participant.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43efa384a1c4ccc439d7b3c214fbd588
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ToggleDots : MonoBehaviour
|
||||
{
|
||||
|
||||
static void ToggleOn(string dot)
|
||||
{
|
||||
GameObject orb = GameObject.Find(dot);
|
||||
orb.SetActive(true);
|
||||
}
|
||||
static void ToggleOff(string dot)
|
||||
{
|
||||
GameObject orb = GameObject.Find(dot);
|
||||
orb.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user