So we’ve finished the tutorials and we will start creating our own game.
As a reminder, our objective in the course is to explore and learn about the Unity engine, game logic and how game objects work.
In the last couple of days we implemented a system to create different tanks in the same scene, the logic to control the game flow and audio mixers.
The tank manager is a script that controls that instantiate a tank in the scene, setting its new color, and defines several methods to modify the behaviour of the tank, like disabling control.
The Game Manager is a script that controls the game (duh), setting the targets for the camera (because there could be different number of tanks), and have different functions that are executed based in the current state of the game (i.e.: starting a round, playing, finishing). We can archive this thanks to coroutines, which are functions that can pause its execution and return to the normal flow of unity (updating the frame, etc.) and then continue executing where it left.
So the Game Manager just defines the number of rounds to win, the delay time to start (a countdown), controls the targets of the camera, instantiates the tanks and the Manager also keeps track of the state of the tanks (to finish the game when there is only one tank left in the scene).
The starting delay just shows the text “tanks!”.
The audio mixer is just like a filter to all the audio sources that the game have, you can just create one in the project folder.
You can also create sub-mixers, so you can divide the sounds of the game and apply different filters to it, in addition to the main mixer.
In the output field of the audio source of the different objects you can select the audio mixer that you want that sound belong to.
And as you can see in the images you can add filters, modify the pitch, level, attenuation and other things until you are satisfied with the sound effects of the game.
The next idea is to create an interface to interact with the tank and game manager scripts. This interface will let the player to set some properties for the game (like adjusting the damage, the force and the color of the tank).