Progress
This week I started to build the workings of the Landolt C test. The test needs to run a specific number of trials, a certain number of times, at specific distances, with rest between the trial attempts. The test also should record a failure and move onto the next trial if 3 seconds pass without a guess. All of the code for that functionality has been written, however it requires multi threading, which ended up taking up most of my time this week.
Struggles
In building the timed component of the test, I ran into an issue with multi-threading. Typically in C# (my experience with it pertains mostly to web development) one would use the System.Timer library to create a timer. However, I need to pass around a bunch of information every time that timer goes off. As that library is geared more towards calling object methods (like service classes for an MVC web application), it’s really not meant for passing info around within the object. The event handler method must be declared as static, so that rout ended there.
The next thing I tried, which took up most of my time, was trying to set up my own medieval multi-threading using Time.DeltaTime from unity itself. Needless to say trying to re-engineer multi-threading myself didn’t go well.
I ended up coming to unity’s co-routine functionality towards the end of my time for the week. I’ll need to learn how that works, and see how I can pass information / call other functions from the event handler for the co-routine call.
Next Week
Once I figure that multi-threading issue, the functionality of the Landolt C test will be complete. Then I’ll be moving onto building a functional UI. Part of why the threading is an issue is because I’m trying to make things as modular / customize-able as possible so that the test can be changed to meet any criteria.
- Enabling choice of perspective
- Main menu and test result display UI
- Prompts for test customization