Now let's go into the game and set up sound for a couple of things here, and I'm going to show you
a trick on how you can make sound effects sound a little bit better.
It's going to make them sound different every time.
Like a little bit different.
Not that much.
It will just give it a minor difference that makes it better.
Let's go to level one.
I'm going to save everything.
And over here we don't have audio manager.
We're going to transfer it from the main menu later on, but as of now we need it.
So I'm going to do audio.
Oh wait I don't want to put sounds again okay let's delete it.
Let's go to scene main menu save asset Prefab.
And I'm going to drag Audio Manager here.
Then I'm going to go to Asset Scene level one.
Save asset prefab audio manager.
Oh yeah.
So as I said before, later on Audio Manager are going to be transferred from the main menu to the game
like scene.
So we don't need to have it here, but now we need to test it.
That's why I'm putting it here.
And let me take the apple.
Maybe I'm going to place it here and I'm going to make duplication of the apples.
Uh, like that.
Also, I want to adjust the level for this testing, so I'm going to do something like that okay.
So now I have.
Bunch of apples that I can pick up.
Let's go to the fruit.
And every time we pick up the fruit, we can play the sound.
Uh, maybe here we can do audio manager, dot instance play suffix, and we need to check the number.
So on the audio manager there is a pick up one and pick up two.
You can check them both.
I'm just going to use the number seven.
So we pass number seven over here.
And let's go and hear the sound.
How does it play right now?
Okay, first of all, it's kind of loud, right?
And also it sounds good, but it sounds very similar.
Also, let me try number eight.
I'm going to go to audio manager.
Find these two sounds pick up.
I'm going to make them lower in volume.
And I'm going to take audio manager and apply overrides.
So it will be changed everywhere.
Now let's go to play mode.
And oh, this one sounds much better.
So soft, I like it.
Now they were sounding good, but they felt very similar.
And it can be okay.
Why not?
Like, I don't mind, but sometimes it may be irritating to hear the same sound again and again.
So there is a trick to make it work.
Um, with the advantage, I would say.
Over here, we can add a random pitch to the sound effect and let me explain what the pitch does.
Let me go and find this pick up sound.
I'm going to enable loop and play on awake.
So it's going to be played constantly okay then in the play mode.
I'm going to take the pitch value and I'm going to change it.
So pitch defines how fast a sound played.
And if you make it faster, it's going to sound a bit higher.
If you make it slower, it's going to sound a bit lower.
And because of that, it can sound differently every time.
We just need to do a suffix with a suffix to play dot pitch equals to random range.
And we need to give it some small difference, like from point nine F to 1.1 F.
All right.
Just that.
And also I want to pass a boolean here bool random which is going to be uh.
True by default.
And I'm going to do this if random pitch, then I'm going to play the sound.
But now if you want, you can disable random pitch for different sound effects just by doing comma pulse
somewhere like here.
For example, you could do comma pulse.
Yeah.
Now we did random pitch for sound effects, and let's go ahead and listen to the sounds again.
Oh.
I'm sorry.
Uh, let's go here and uncheck play on Awake and Loop.
Okay.
Let's go again.
And I'm going to pick them up.
And it sounds a little bit different every time, which I think is really nice.
Okay, so the system is working.
This is good.
Now you can go ahead and set up other sounds by yourself.
Just go like to the death function call the death sound and so on.
Or you can wait for me.
I'm going to show you how to do that in one of the videos.
Or should we do it right now?
Yeah.
Let's do it right now.
Okay.
Let's do it.
Uh, this sound, this sound has index zero, and it is called when player dies inside of a die method.
Day.
So I'm going to do audio manager.
That instance.
Um.
Um play SFX.
Zero.
Then we have enemy kicked.
So that happens when we kick the enemy and we can do that.
Give me a second.
I need to think.
Where do we kick the enemy?
Handle enemy detection here.
So we're going to do audio manager dot instance.
Play SFX with one, if I'm not mistaken.
Let's go back.
And the finish line when we finish the game and there is a jump.
So number two is finished.
Number three is a jump.
Let's go to the checkpoint.
Finish point.
I'm going to do audio manager dot instance play suffix of two.
And for the jump, it happens on the player.
Not in a jump button because jump button can be pressed, but there is no jump, so we need to do it
in the jump.
I'm going to open curly brackets for this one.
And the audio manager.
That instance, play a suffix of.
Three and same goes in double jump.
Or you can have a different sound for double jump if you like.
You can use different sound for that.
For the wall jump.
I think I found the sound for the wall jump.
Number 12.
Uh, you would only have to go and adjust the volume on sound effects.
And I cannot help you here because, you know, you might have different speakers, or I might have
it sound differently from yours.
And even if I show you my values, they will be different from what you need to have.
So that is on you.
You need to decide on the volume of sounds.
Now there is a respawn.
Respond one.
Respond to.
I'm going to use number two.
And when we respawn, the player.
Let's call it when we are ready to run.
Right.
So I'm going to go.
Respawn finished.
And if respawn is finished, I'm going to do audio manager dot instance play suffix of number.
What else player is damaged number nine.
So this will happen in a knockback audio manager dot instance.
Player suffix 11.
Uh oh.
Sorry.
Nine.
Number nine.
And we have pickup.
We did it.
No money is when you cannot purchase the skin.
We're going to do it.
Uh, jump is done.
Finish is done.
Enemy kick.
Okay.
Only no money sound.
And if you don't have any other sounds in the game, like maybe you want to play sound when fire is
burning from the trap or anything like that, you will have to find sound by yourself.
I'm going to show you how to find sounds, but there it's on you.
All right.
I trust you can do that.
And that is the place where you're going to be creative.
Okay, so let's, uh, improve, I mean.
Implement the no money sound.
On a level selection.
Over here somewhere?
No, sorry.
No level selection.
Skin selection.
We can return false if we don't have enough money.
It happens over here.
So I'm going to do audio manager instance.
Oh wait this will buy skin over here on the manager.
Instance, play a suffix of.
Um.
Number six.
And I think we can play sound when we successfully purchase the skin.
I have a sound there.
Audio manager instance play.
Instance player suffix.
Of first respawn.
Let's let's use this sound.
Yeah.
I forgot the number.
Can you imagine?
My short memory is killing me.
Number ten.
Okay, so this is good.
Uh, sounds supposed to be working fine, so I'm not going to even check them.
I will adjust the volume, but most of the time I'm going to enable mute mode because I'm recording
and I need to hear myself.
And it can be destructive.
Yeah.
Okay.
This is good.
And let's go to the next video.
I'll see you there.
Hmm.
What is this error?
I doesn't have skin manager.
Okay, guys, I'll see you in the next video.