Working experiment hooray
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,6 +10,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
int trialIndex;
|
||||
int trialDotIndex;
|
||||
Participant participant;
|
||||
List<GameObject> dots = new List<GameObject>();
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
//FOR THE LOVE OF GOD FUCKING DELETE THIS, SERIOUSLY CHRIS DON'T YOU DARE FORGET
|
||||
@@ -22,6 +24,7 @@ public class ExperimentController : MonoBehaviour {
|
||||
trialDotIndex = 0;
|
||||
foreach (GameObject go in GameObject.FindGameObjectsWithTag("Dot"))
|
||||
{
|
||||
dots.Add(go);
|
||||
Hide(go);
|
||||
};
|
||||
|
||||
@@ -29,19 +32,17 @@ public class ExperimentController : MonoBehaviour {
|
||||
|
||||
void Hide(GameObject dot)
|
||||
{
|
||||
dot.GetComponent<SpriteRenderer>().enabled = false;
|
||||
//dot.GetComponent<CircleCollider2D>().enabled = false;
|
||||
dot.SetActive(false);
|
||||
}
|
||||
|
||||
void Show(GameObject dot)
|
||||
{
|
||||
dot.GetComponent<SpriteRenderer>().enabled = true;
|
||||
//dot.GetComponent<CircleCollider2D>(). = true;
|
||||
dot.SetActive(true);
|
||||
}
|
||||
|
||||
public void NextDot()
|
||||
{
|
||||
nextDot = GameObject.Find(participant.trials[trialIndex][trialDotIndex]);
|
||||
nextDot = FindDot(participant.trials[trialIndex][trialDotIndex]);
|
||||
trialDotIndex++;
|
||||
Show(nextDot);
|
||||
Hide(startDot);
|
||||
@@ -61,4 +62,13 @@ public class ExperimentController : MonoBehaviour {
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
GameObject FindDot(string name)
|
||||
{
|
||||
foreach(GameObject dot in dots)
|
||||
{
|
||||
if (dot.name == name) return dot;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user