Day 2 - Progress

Let's finish the pre-production stage!


Finalize class structure

Today I started by finalizing the class structures. I already created a class diagram and the scripts. So my next step is to add the variables and functions to the scripts.

I like to use regions in my code, to keep my code structured and clear. With this structure, I think, it's easier to find a certain piece of code, also you can fold and unfold the regions you will or won't need. But this is just my personal preference.

Naming convention
It's important to have a clear naming convention. Though there are many different opinions on this topic, I found a naming convention that fit me. For my funtions I use PascalCasing, for my public variables I use camelCasing and for my private variables I use _camelCasing with a single underscore. And for my constant variables I use UPPER_CASE.

The image below shows an example of how my scripts look after finalizing the class structure. It basically looks like a framework.



Finalize test scene set up
I've added a few objects to the testscene and adjusted the scaling. I've created a desk with two interactive object: the chair and the monitor. The objects are all placeholders for testing purposes. After completing my code I will make the 3D models. The image below shows my set up. I might add or delete objects along the way, but for now I have everything I need to start creating my prototype.

























Camera set up
Yesterday I already attached the main camera(left image) as a child to the character, because the game/experience will have first person perspective view. Now I also added the camera script component to the main camera. When the player interacts with the computer the camera will switch to the monitor camera (right image) with an orthographic view. For now the screen is just blue, because the interactive game object has a blue material, but further in the development progress this is where the puzzles/challenges will be shown.











Audio set up
I added an audio manager to the scene with an audio source and audio manager script. This audio manager will contain a play script and all of the audio files. The actual implementation of the audio files will be happening in the production stage.


Now that all has been set up, the pre-production stage is completed and I can start the actual programming! :)



Character movement script
I programmed the basic character movement script. The player can now move the character around using horizontal input for rotation and vertical input for moving forwards or backwards. The movement still needs some tweeking, but I will work on that when I'm further in the process. 

I use two scripts for the character movement. The first is the player script which registers player input and stores it into static floats and the second is the character movement script which uses the input from the player script to transform the player character's rigidbody.

Camera switch script
I had to rename my camera script into CameraSwitch, because it was conflicting with Unity's own camera behaviour (luckily, someone on the Unity forum posted about the solution after experiencing the same issue, so it was a quick fix for me). 

I added the two public camera's to my script and set the mainCamera (first person view) as default. 

To create the actual switch function I first have to program the interactive object behaviour.

Comments