Skip to content
Snippets Groups Projects
Commit 77de2e2b authored by 13035516's avatar 13035516
Browse files

remembers state and changes between yellow, green and red

parent 009a2a75
Branches
No related merge requests found
No preview for this file type
......@@ -29,7 +29,7 @@ public class ExperimentController : MonoBehaviour
private string[] TableHeader;
private float[] TableData;
private ChangeColour[] GoalsChangeColor;
private ChangeColour[] GoalsChangeColour;
private int ExperimentTrial = 0;
private float Timer = 0f;
......@@ -44,7 +44,7 @@ public class ExperimentController : MonoBehaviour
void Awake()
{
GoalsChangeColor = new ChangeColour[Goals.Length];
GoalsChangeColour = new ChangeColour[Goals.Length];
}
// Start is called before the first frame update
......@@ -61,7 +61,7 @@ public class ExperimentController : MonoBehaviour
for (int i = 0; i < Goals.Length; i++)
{
GoalsChangeColor[i] = Goals[i].GetComponent<ChangeColour>();
GoalsChangeColour[i] = Goals[i].GetComponent<ChangeColour>();
}
/* GoalSet = GoalSetter.Next(NumGoals); */
/* OnsetDev = OnsetDeviator.Next(mTimingSetting.TargetOnsetDev); */
......@@ -78,11 +78,19 @@ public class ExperimentController : MonoBehaviour
if (Timer > mTimingSetting.TrialStart)
{
bool[] states = CheckGoalStates(GoalsChangeColor);
if (!states.All(x => x))
bool[] states = CheckGoalStates(GoalsChangeColour);
bool flag = false;
for (int i = 0; i < NumGoals; i++)
{
if (states[i])
{
flag = true;
}
}
if (!flag)
{
GoalSet = GoalSetter.Next(NumGoals);
GoalsChangeColor[GoalSet].GoalState = 1;
GoalsChangeColour[GoalSet].GoalState = 1;
OnsetDev = OnsetDeviator.Next((int)mTimingSetting.TargetOnsetDev*2) -
mTimingSetting.TargetOnsetDev;
}
......@@ -91,9 +99,15 @@ public class ExperimentController : MonoBehaviour
if (Timer > (mTimingSetting.TrialStart +
mTimingSetting.TargetOnset + OnsetDev) )
{
/* GoalsChangeColour[GoalSet].GoalState = 2; */
GoalsChangeColour[GoalSet].GoalState = 2;
}
// If the player is in the target start counting
if (Timer > 3500)
{
ExperimentTrial++;
GoalsChangeColour[GoalSet].GoalState = 0;
}
// If the player hasn't achieved the hold time in the allotted time
......
......@@ -29,7 +29,7 @@ public class ExperimentController : MonoBehaviour
private string[] TableHeader;
private float[] TableData;
private ChangeColour[] GoalsChangeColor;
private ChangeColour[] GoalsChangeColour;
private int ExperimentTrial = 0;
private float Timer = 0f;
......@@ -44,7 +44,7 @@ public class ExperimentController : MonoBehaviour
void Awake()
{
GoalsChangeColor = new ChangeColour[Goals.Length];
GoalsChangeColour = new ChangeColour[Goals.Length];
}
// Start is called before the first frame update
......@@ -61,7 +61,7 @@ public class ExperimentController : MonoBehaviour
for (int i = 0; i < Goals.Length; i++)
{
GoalsChangeColor[i] = Goals[i].GetComponent<ChangeColour>();
GoalsChangeColour[i] = Goals[i].GetComponent<ChangeColour>();
}
/* GoalSet = GoalSetter.Next(NumGoals); */
/* OnsetDev = OnsetDeviator.Next(mTimingSetting.TargetOnsetDev); */
......@@ -78,11 +78,19 @@ public class ExperimentController : MonoBehaviour
if (Timer > mTimingSetting.TrialStart)
{
bool[] states = CheckGoalStates(GoalsChangeColor);
if (!states.All(x => x))
bool[] states = CheckGoalStates(GoalsChangeColour);
bool flag = false;
for (int i = 0; i < NumGoals; i++)
{
if (states[i])
{
flag = true;
}
}
if (!flag)
{
GoalSet = GoalSetter.Next(NumGoals);
GoalsChangeColor[GoalSet].GoalState = 1;
GoalsChangeColour[GoalSet].GoalState = 1;
OnsetDev = OnsetDeviator.Next((int)mTimingSetting.TargetOnsetDev*2) -
mTimingSetting.TargetOnsetDev;
}
......@@ -94,6 +102,12 @@ public class ExperimentController : MonoBehaviour
GoalsChangeColour[GoalSet].GoalState = 2;
}
// If the player is in the target start counting
if (Timer > 3500)
{
ExperimentTrial++;
GoalsChangeColour[GoalSet].GoalState = 0;
}
// If the player hasn't achieved the hold time in the allotted time
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment