To add music to the game, firstly create a new empty Game Object called musicController and give it a starting state called Play Music in its FSM.
In the Inspector tab for the musicController object, click Add Component and add an Audio Source component that will allow the controller to actually play music. Drag the Boss Fight track from the myAudio folder into the Audio Clip field and also make sure to check the Play On Awake and Loop box, to ensure that the music starts as soon as the game begins and continues looping right up until the game ends.
Now we are going to add sound effects to the enemies and bullets.Click on the Enemy prefab and add an Audio Source component from the Inspector window. Select the audio clip by pressing the circle button to the right of the AudioClip field and select the mai_free_08_damage audio track. Make sure to also un-check the Play On Awake box.
Now move to the Enemy’s FSM and click on the Dead state. Add an Audio Play action directly after the Set Animator Bool actions. Make sure the settings are the same as in the following picture.
Now we are going to add sound effects to the gun. Add an Audio Source component to gunController_R in the same way as the musicController and Enemy and then drag in the shot_hand_gun audio clip to the AudioClip field. Make sure to also set Play On Awake to False.
Now go to the Spawning Bullet state in gunController_R’s FSM and add an Audio Play action, with the exact settings as shown in the picture below.
Now we will move on to discuss the user’s teleportation in the game, as STYLY allows the player to teleport across the surface of any object with a collider attached to it.