Day 8 - Progress

I have to work even harder, because the deadline is getting very close!

Challenge System - Test Run
There were some issues with the test run, I had some trouble setting the right conditions for the Test Run. Each time I thought I'd figured it out, it turned out to be that only part of the conditions were actually checked. I tried different approaches, but settled on a system where I check for the amount of answers given in the draggable item and I check for right/wrong answers in the dropzone script (which I finished yesterday). At first I tried to get everything into the dropzone script, but it didn't make any sense and was giving me one error after another.

My approach for the amount of answers is to first check if the dragged item came from the same panel or not. If it's from a different panel I have to modify the integer, if not, the amount of given answers stays the same.











My console (in the image above) shows:
  • when I dragged the item from the OptionPanel onto the DropArea I gave a new answer, so it increases;
  • when I dragged the item from one DropArea onto another, I changed my answer, but I didn't add a new one, so it stays the same;
  • when I dragged the item from the DropArea back onto the OptionPanel, I removed one given answer, so it decreases.
This was really a process of trial and error. But in the end I managed to get the system to work.

Challenge Implementation - Monitor UI

Next I started working on improving the monitor UI, I also added the UI elements that where missing. I implemented the timer, the attempts counter, a test run button and a start challenge button into the UI. I created four buttons/text boxes on the right in a horziontal layout panel. For now this will do, but I'd really like to create a good looking UI, if I have the time for it. 

Scene Switch

It has been a while since I opened my old test scenes. So I decided to clean up my project a bit. I deleted two old scenes that didn't hold any valuable testing elements. Then I tested my first test scene, which represents the virtual world. Some things weren't working properly, so had to fix it. 

Also I changed the interaction approach with the monitor. In the early development process I decided on having a camera switch and keeping the gameplay in one scene. But I soon figured that I had a better overview and structure when working in two scenes; one for the monitor and one for the virtual world (first person view). However, I didn't delete the camera switch script, because it was working and it might come in handy for other purposes, e.g. a locked zoom for interaction with interactive objects (if so, I need to set it to perspective view). 


So instead of the camera switch I needed to create a scene switch by using Unity's SceneManager. When the player uses the monitor the scene will switch from the virtual world scene to the monitor scene.


Interactive objects
I changed the behaviour on object interaction a bit. The way it was, the player could interact with any interactive object that could be clicked on, even when standing at the other side of the room. This doesn't feel natural at all, I wanted the player only to be able to interact with an object withing range. So I created an empty gameobject with a box collider as a child for the player with a trigger function. Then I created the script in Interactive Objects to enable interaction within range. When the player is in range of the monitor and interacts with it, the game loads the monitor scene. When the player is in range of another interactive object and interacts with it, the interact function is being called. As you can see in the image below, the player is able to interact with the interactive object within range. When I walked backwards interaction was disabled and then when I got within range again interaction was enabled. I will tweak the collider range when the set dress of the virtual world is completed.





















Monitor UI

Back to the Monitor UI again! Each off the UI elements has its own conditions I also had to implement. E.g. the timer should not start before pressing the start challenge button. The test run button should only be activated when all DropArea's are filled with an answer. And then I also had to reset the timer, the attempts counter, the answers given, the right and the wrong answers after successfully completing a test run. For the buttons I used the onClick event to trigger the functions and the rest is set in script. This was even more trial and ettot. After each change I ran the game to test if it was working properly. In the image below you see the conditions I set for each UI element.




When I'm coding for hours straight I tend to start overthinking things a little. Therefor I try to do other tasks, like cleaning up my code, drawing flowcharts for next steps, thinking about UI and audio design. Just so I can get back at it with a clear mind. This really improves my concentration and workflow.









Comments