Pause/Death UI, Sound
I was able to script a pause and death user interface menu into the game.
The difference between the pause and death menus is that the death menu does not come up with the option to resume. On both menus the user is able to see the cursor, contrary to the cursor being invisible during gameplay. All music and gameplay is also stopped, this was done by enabling the line of code ‘Time.timescale = 0′.

I found some royalty-free music on Kevin McCleod’s website that fit in well with the theme of the game. They can serve as placeholder tracks for now but I think they could even work for the final product, depending on our other options. The pitches of the tracks are adjusted in-game to fit better, Unity is slightly slower and Rhinocerous is slightly faster.
Title
Gameplay
I was able to make the music slow down to a stop on death by creating this code:
public float pitchSpeed = 1.19f;
void Update ()
{
AudioSource audio = GetComponent();
audio.pitch = pitchSpeed;
if (PlayerDie.PlayerAlive == false)
{
pitchSpeed = (pitchSpeed * 0.9f);
if (audio.pitch <= 0)
{
audio.pitch = 0;
}
}
if (pauseGame.paused == true)
{
audio.pitch = 0;
}
if (pauseGame.paused == false && PlayerDie.PlayerAlive == true)
{
audio.pitch = 1.19f;
}
}
This works well because it put emphasis on halting the players momentum. Suddenly stopping the music wouldn’t sound very professional so this is most likely the best way we can accomplish a sudden stop in the audio that is easy on the ears.










