470 Sprint 5

Work Completed

For this sprint, in short, I worked on the ball bounce audio, goal fireworks implementaion, a hoop magnet, main menu system, and rat selection screen. 

For the ball bounce audio I utlized the audio source game component and made a simple script to trigger the sound. For the goal fireworks, I used the VFX prefab created by the team and added some code to have it play on a player's goal. For the hoop magnet, I made it so that the player has an easier time making the ball into the hoop. For the main menu system, we overhauled using Unity's scene management to now using a singular scene for the menu options and gameplay. Lastly, I was able to make a menu option where the player could select their rat color before loading into their match.

The ball bounce audio used an audio clip and then I had to tell the script when it should play. Since it will be inside an indoor arena, it was determined that the audio playing on ground and wall contact would make the most sense and be the most realistic. Below is the simple function tying in the audio source and the ball gameobject in the scene.

A similar approach was used to play the fireworks effect on a goal scored. This time, the event bus implemented in the project was used. Looking back, I could have had the GoalVFX script publish to the event bus, but this was my first time using the event bus programming pattern, so I referenced the GoalVFX play fireworks function in the game manager script that is subscribed to the event bus. I learned how to have other scripts publish to the event bus and fire off certain functions when something happens in the game state. This is something I can build upon going forward in the project.

When implementing a hoop magnet, I had a couple trial and error moments when finding the best way to replicate a magnet effect while not being too obvious or being too weak. At first, I tried to lerp the distance from the ball to the hoop if it was within the magnet's distance, but this effect was too weak for a moving object. Then after some research, I found the MoveTowards Vector3 method. This worked better, so I decided to go with this approach. There needs to be some improvements like having the magnet deactivate once the ball reaches its position so that the ball can drop in the hoop and not stick to the magnets position.

The main menu system used the event bus a lot. This is because the game is now in a single scene. This means that the game cannot start until the play button is clicked. That also means that different canvas UI needs to be displayed based on what menu is currently selected. Also, since we need all the different menus in the same scene that means we need different cameras to be displayed. This is specifically important for the character selection screen. There is an area that needs to be shown on camera away from the game arena displaying the different rats. The different menu areas being shown in the same scene brings some challenges but with the event bus, it was easier to disable certain areas and active others based on the game state.

Above is the rat character selection screen in action. It takes in an array of the rat options and once the player selects their rat, it deletes the non-selected rats. In the next sprint, I will need to work on implementing the selected rat into the game scene and adding a player movement component once loaded into the game scene. This will take some time as we will need to figure out how to make the different variables loaded and able to be received in the game scene without having to rely on the public variables being dragged values in the inspector.


Comments

Popular Posts