Skip to content

Commit 6ad9aec

Browse files
Jack BrookesJack Brookes
authored andcommitted
Updated example
1 parent 4acad0d commit 6ad9aec

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed
File renamed without changes.

Assets/ExpMngr/ExampleScript.cs renamed to Assets/ExpMngr/Examples/Basic/BasicExampleScript.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77
/// <summary>
88
/// Example script used to test functionality of the Experiment Manager
99
/// </summary>
10-
public class ExampleScript : MonoBehaviour {
10+
public class BasicExampleScript : MonoBehaviour {
1111

1212
ExpMngr.ExperimentSession exp;
1313
float startNextTime;
1414

1515

1616
void Start()
1717
{
18-
// disable this behavior so the Update() function doesnt run.
18+
// disable this behavior so the Update() function doesnt run just yet.
1919
enabled = false;
2020
}
2121

22-
public void GenerateAndRunExperiment(ExpMngr.ExperimentSession expSession) {
22+
public void GenerateAndRunExperiment(ExpMngr.ExperimentSession expSession)
23+
{
24+
2325
exp = expSession;
2426
/// This function can be called using the ExperimentSession inspector OnSessionStart() event, or otherwise
2527

@@ -40,7 +42,7 @@ public void GenerateAndRunExperiment(ExpMngr.ExperimentSession expSession) {
4042
// / of an ExperimentSession component as a dictionary
4143

4244
// create our blocks & trials
43-
45+
4446
// practice block
4547
var practiceBlock = new ExpMngr.Block(exp); // block 1
4648
for (int i = 0; i < Convert.ToInt32(exp.settings["n_practice_trials"]); i++)

Assets/ExpMngr/Scripts/ExperimentSession.cs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public class ExperimentSession : MonoBehaviour
7373
public bool isQuitting = false;
7474

7575
/// <summary>
76-
/// Settings for the experiment. These are automatically loaded from file on initialisation of the session.
76+
/// Settings for the experiment. These are provided on initialisation of the session.
7777
/// </summary>
7878
public Settings settings;
7979

@@ -93,12 +93,12 @@ public class ExperimentSession : MonoBehaviour
9393
public Trial nextTrial { get { return NextTrial(); } }
9494

9595
/// <summary>
96-
/// Alias of PrevTrial()
96+
/// Get the trial before the current trial.
9797
/// </summary>
9898
public Trial prevTrial { get { return PrevTrial(); } }
9999

100100
/// <summary>
101-
/// Alias of LastTrial()
101+
/// Get the last trial in the last block of the session.
102102
/// </summary>
103103
public Trial lastTrial { get { return LastTrial(); } }
104104

@@ -174,9 +174,9 @@ public List<Trial> trials
174174
/// </summary>
175175
public List<string> trackingHeaders { get { return trackedObjects.Select(t => t.objectNameHeader).ToList(); } }
176176
/// <summary>
177-
/// Stores combined list of headers.
177+
/// Stores combined list of headers for the behavioural output.
178178
/// </summary>
179-
[HideInInspector] public List<string> headers;
179+
public List<string> headers { get { return baseHeaders.Concat(settingsToLog).Concat(customHeaders).Concat(trackingHeaders).ToList(); }}
180180

181181
/// <summary>
182182
/// Queue of actions which gets emptied on each frame in the main thread.
@@ -192,9 +192,6 @@ void Awake()
192192
{
193193
// start FileIOManager
194194
fileIOManager = new FileIOManager(this);
195-
196-
// create headers
197-
headers = baseHeaders.Concat(customHeaders).Concat(trackingHeaders).Concat(settingsToLog).ToList();
198195
}
199196

200197
// Update is called once per frame
@@ -352,7 +349,7 @@ public Trial GetTrial(int trialNumber)
352349
/// Get next Trial
353350
/// </summary>
354351
/// <returns></returns>
355-
public Trial NextTrial()
352+
Trial NextTrial()
356353
{
357354
// non zero indexed
358355
try
@@ -377,7 +374,7 @@ public void BeginNextTrial()
377374
/// Get previous Trial
378375
/// </summary>
379376
/// <returns></returns>
380-
public Trial PrevTrial()
377+
Trial PrevTrial()
381378
{
382379
// non zero indexed
383380
try
@@ -394,7 +391,7 @@ public Trial PrevTrial()
394391
/// Get last Trial in experiment
395392
/// </summary>
396393
/// <returns></returns>
397-
public Trial LastTrial()
394+
Trial LastTrial()
398395
{
399396
return trials[trials.Count - 1];
400397
}
@@ -403,15 +400,15 @@ public Trial LastTrial()
403400
/// Get currently active block.
404401
/// </summary>
405402
/// <returns>Currently active block.</returns>
406-
public Block GetBlock()
403+
Block GetBlock()
407404
{
408405
return blocks[blockNum - 1];
409406
}
410407

411408
/// <summary>
412409
/// Get block by block number (non-zero indexed).
413410
/// </summary>
414-
/// <returns>Currently active block.</returns>
411+
/// <returns>Block.</returns>
415412
public Block GetBlock(int blockNumber)
416413
{
417414
return blocks[blockNumber - 1];

0 commit comments

Comments
 (0)