1
00:00:00,000 --> 00:00:03,530
Welcome back my fellow game developers

2
00:00:03,525 --> 00:00:06,725
to one of the more exciting parts.

3
00:00:06,720 --> 00:00:08,250
Maybe it's a bit smaller

4
00:00:08,249 --> 00:00:10,019
when it comes to the length of videos.

5
00:00:10,020 --> 00:00:11,910
I'm in the length of the whole section,

6
00:00:11,910 --> 00:00:15,530
but it really makes much bigger difference in our game.

7
00:00:15,525 --> 00:00:18,785
So now when we run the game, There you go.

8
00:00:18,780 --> 00:00:20,700
You can see that we have in music,

9
00:00:20,700 --> 00:00:23,120
we walk around, we shoot our enemies.

10
00:00:23,115 --> 00:00:24,705
We tried to kill the skeleton,

11
00:00:24,705 --> 00:00:26,745
and for some reason we die.

12
00:00:26,745 --> 00:00:28,325
All my god.

13
00:00:28,320 --> 00:00:31,620
Oh my god. How much do you feel the pressure now that

14
00:00:31,620 --> 00:00:34,970
we've applied fields so scary that we died.

15
00:00:34,965 --> 00:00:38,165
Not only do we have the black screen for you died,

16
00:00:38,160 --> 00:00:40,870
but we also have the music changing on us,

17
00:00:40,870 --> 00:00:43,690
which adds a very scary atmosphere.

18
00:00:43,685 --> 00:00:45,095
Okay, maybe not that much,

19
00:00:45,095 --> 00:00:46,865
but you feel the gravity

20
00:00:46,865 --> 00:00:48,875
of your death much more right now.

21
00:00:48,875 --> 00:00:50,765
So without any further ado,

22
00:00:50,765 --> 00:00:52,385
let's not waste any more time,

23
00:00:52,385 --> 00:00:54,565
and let's get started.

24
00:00:54,560 --> 00:01:01,180
Okay, so time to add a bit of music and sound effects.

25
00:01:01,175 --> 00:01:04,225
Of course, I love this part of the game because

26
00:01:04,220 --> 00:01:07,280
this is where we add the magic to the game,

27
00:01:07,280 --> 00:01:11,030
where we make it just a little bit more amazing.

28
00:01:11,030 --> 00:01:13,070
So first thing, first,

29
00:01:13,070 --> 00:01:14,510
I'm going to go into

30
00:01:14,510 --> 00:01:17,570
the Prefabs and I'm going to Prefab the weapons

31
00:01:17,570 --> 00:01:22,400
just and let's just add it to the Sure.

32
00:01:22,400 --> 00:01:24,610
Let's add it to the pickups. Why not?

33
00:01:24,605 --> 00:01:26,195
Why not?

34
00:01:26,195 --> 00:01:27,965
Or level objects,

35
00:01:27,964 --> 00:01:29,634
maybe level objects would

36
00:01:29,630 --> 00:01:31,490
have been a better place to put it.

37
00:01:31,490 --> 00:01:35,590
So I'm going to move these to the level objects.

38
00:01:35,585 --> 00:01:37,435
Okay, great, move that out of the way.

39
00:01:37,430 --> 00:01:38,930
Let's go into the assets.

40
00:01:38,930 --> 00:01:43,680
Let's right-click in here and create an audio.

41
00:01:44,050 --> 00:01:47,360
Just all you double-click in here.

42
00:01:47,360 --> 00:01:49,580
And I'm going to create two folders,

43
00:01:49,580 --> 00:01:54,800
one for the music and one for the sound effects.

44
00:01:54,800 --> 00:01:57,220
Just call it as f x.

45
00:01:57,215 --> 00:02:00,625
For some fact, I'm going to go into the resources.

46
00:02:00,620 --> 00:02:04,610
And here you can see that we have these four musics.

47
00:02:04,610 --> 00:02:06,910
Let's go ahead and add all of them.

48
00:02:06,905 --> 00:02:09,155
I'm not sure which one we're going to be using,

49
00:02:09,155 --> 00:02:12,275
so I'll add the all of them into the music.

50
00:02:12,275 --> 00:02:14,315
Wait for that. If it takes too long,

51
00:02:14,315 --> 00:02:17,335
I'm going to use the magic of editing 0.

52
00:02:17,330 --> 00:02:20,570
And now let's go into the sound effects.

53
00:02:20,570 --> 00:02:22,640
So as a fox, I will select

54
00:02:22,640 --> 00:02:24,730
all of them except for these two.

55
00:02:24,725 --> 00:02:27,035
I'm not sure why they are still there,

56
00:02:27,035 --> 00:02:29,365
but I'm going to go ahead and add them until

57
00:02:29,360 --> 00:02:31,040
the sound effects and wait for

58
00:02:31,040 --> 00:02:32,960
them to be added. Okay, great.

59
00:02:32,960 --> 00:02:34,580
So let's double-click on the music

60
00:02:34,580 --> 00:02:36,220
and let's see what we have in here.

61
00:02:36,215 --> 00:02:39,385
So if I click on the fly and if

62
00:02:39,380 --> 00:02:43,490
I tried to turn on the volume of it on my computer,

63
00:02:43,490 --> 00:02:45,430
I can listen to it.

64
00:02:45,425 --> 00:02:48,305
Listen to a preview of it.

65
00:02:50,620 --> 00:02:51,970
Okay.

66
00:02:51,965 --> 00:02:53,935
So obviously you can hear it.

67
00:02:53,930 --> 00:02:55,850
So now what we'll do is we are

68
00:02:55,850 --> 00:02:58,070
going to play that music and our game.

69
00:02:58,070 --> 00:02:59,450
And it's pretty simple.

70
00:02:59,450 --> 00:03:00,860
Whenever you want to play music,

71
00:03:00,860 --> 00:03:03,190
you can simply drag it in here.

72
00:03:03,185 --> 00:03:04,675
There we go. You can see that

73
00:03:04,670 --> 00:03:06,910
now Let's make this smaller.

74
00:03:06,905 --> 00:03:10,475
You can see that I have the fly in here.

75
00:03:10,475 --> 00:03:12,755
And one of the cool things that we can do

76
00:03:12,755 --> 00:03:15,265
is we can simply just from the game right now.

77
00:03:15,260 --> 00:03:17,330
And you can see we have an option here which

78
00:03:17,330 --> 00:03:19,570
is play on awake and the loop.

79
00:03:19,565 --> 00:03:20,695
So I'm going to put it to

80
00:03:20,690 --> 00:03:22,520
loop because we don't want the music

81
00:03:22,520 --> 00:03:25,630
to actually end when the actual song finishes.

82
00:03:25,625 --> 00:03:28,045
So now when I run the game,

83
00:03:28,040 --> 00:03:31,910
and obviously nothing is happening.

84
00:03:31,910 --> 00:03:33,140
Why is that?

85
00:03:33,140 --> 00:03:37,090
Well, because the music isn't actually playing on awake.

86
00:03:37,085 --> 00:03:38,035
Oh, okay.

87
00:03:38,030 --> 00:03:40,480
So it took me about

88
00:03:40,475 --> 00:03:44,125
three to four minutes to figure out what the problem is.

89
00:03:44,120 --> 00:03:48,050
I was so confused and I had the mood of your own.

90
00:03:48,050 --> 00:03:49,910
So now when I turn it off,

91
00:03:49,910 --> 00:03:55,340
when we run the game, There we go.

92
00:03:55,340 --> 00:03:57,640
You can see that we start playing the music.

93
00:03:57,635 --> 00:03:59,315
I'm just going to turn this down.

94
00:03:59,315 --> 00:04:01,675
And how are we playing this music?

95
00:04:01,670 --> 00:04:04,790
I want you to pay attention to what we have in here.

96
00:04:04,790 --> 00:04:07,390
We use something called the audio source.

97
00:04:07,385 --> 00:04:08,575
And the audio source,

98
00:04:08,570 --> 00:04:10,940
you can see that it has an audio clip on it.

99
00:04:10,940 --> 00:04:13,850
So the clip that we are going to play an output

100
00:04:13,850 --> 00:04:17,110
which we'll talk about later when we add an audio mixer,

101
00:04:17,105 --> 00:04:18,625
we have the priority,

102
00:04:18,620 --> 00:04:20,990
the volume, the beach, and etc.

103
00:04:20,990 --> 00:04:22,700
So and we also have 3D

104
00:04:22,700 --> 00:04:24,650
sounds that you can play around with.

105
00:04:24,650 --> 00:04:25,940
So as you can see,

106
00:04:25,940 --> 00:04:29,030
as soon as we add any kind of music to our game,

107
00:04:29,030 --> 00:04:31,150
we can immediately play it.

108
00:04:31,145 --> 00:04:34,345
But obviously this is not how we want things to work.

109
00:04:34,340 --> 00:04:37,390
We want to be able to control all of that.

110
00:04:37,385 --> 00:04:39,565
So in here we can see that we have

111
00:04:39,560 --> 00:04:41,420
the multiple flights or let's try

112
00:04:41,420 --> 00:04:44,370
the fly one and see how that sounds.

113
00:04:45,760 --> 00:04:49,030
Or the industry.

114
00:04:49,025 --> 00:04:51,715
And I think I'm going to use

115
00:04:51,710 --> 00:04:53,930
this fly and I'm going to call this

116
00:04:53,930 --> 00:05:00,860
the level music and use the fly as the death music.

117
00:05:00,860 --> 00:05:03,260
So music, There we go.

118
00:05:03,260 --> 00:05:04,880
You can see now it's the level music.

119
00:05:04,880 --> 00:05:06,290
It's still called fly.

120
00:05:06,290 --> 00:05:10,670
And the fly one will be the death music hit Enter.

121
00:05:10,670 --> 00:05:12,950
And now we have these two sounds.

122
00:05:12,950 --> 00:05:15,440
So before we go into the sound effects,

123
00:05:15,440 --> 00:05:16,820
Let's go ahead and create

124
00:05:16,820 --> 00:05:18,920
something called the Audio Manager.

125
00:05:18,920 --> 00:05:22,010
So I'm going to first of all remove the fly right here.

126
00:05:22,010 --> 00:05:24,530
I'm going to right-click create an empty.

127
00:05:24,530 --> 00:05:27,850
And this will be a game object.

128
00:05:27,845 --> 00:05:30,055
And I'm going to call it the,

129
00:05:30,050 --> 00:05:35,090
I call it the gameObject seriously, audio manager.

130
00:05:35,090 --> 00:05:37,000
I'm going to reset its position.

131
00:05:36,995 --> 00:05:38,275
It doesn't matter where it is,

132
00:05:38,270 --> 00:05:40,450
but I'm going to reset it in any case.

133
00:05:40,445 --> 00:05:42,275
And in the scripts right here,

134
00:05:42,275 --> 00:05:44,215
I'm going to go into

135
00:05:44,210 --> 00:05:45,940
the managers do have

136
00:05:45,935 --> 00:05:48,565
a folder for the managers. Nope, we don't.

137
00:05:48,560 --> 00:05:51,890
So I'm going to right-click create a C-sharp script

138
00:05:51,890 --> 00:05:56,140
called the Audio Manager.

139
00:05:56,135 --> 00:05:58,295
Hit Enter and right-click,

140
00:05:58,295 --> 00:06:02,525
create a folder for the managers.

141
00:06:03,970 --> 00:06:06,950
What did it not change?

142
00:06:06,949 --> 00:06:10,459
Managers, please. Manager.

143
00:06:10,455 --> 00:06:12,435
So oh, okay. We already

144
00:06:12,430 --> 00:06:15,640
have a folder optima managers delete that.

145
00:06:15,640 --> 00:06:17,530
So managers.

146
00:06:17,530 --> 00:06:19,540
Oh, there was a folder for the managers.

147
00:06:19,540 --> 00:06:22,590
Why did I not get in any case?

148
00:06:22,585 --> 00:06:25,725
Let's open up the managers lets the Audio Manager to

149
00:06:25,720 --> 00:06:27,430
the audio manager and let's

150
00:06:27,430 --> 00:06:29,910
double-click and see what we are going to do in here.

151
00:06:29,905 --> 00:06:32,205
Now, the AudioManager, something that

152
00:06:32,200 --> 00:06:34,570
we are going to be calling out a lot.

153
00:06:34,570 --> 00:06:36,880
So I'm going to create an instance out of it.

154
00:06:36,880 --> 00:06:45,250
So public, static or your manager instance.

155
00:06:45,250 --> 00:06:48,940
And I'm going to create the awake and

156
00:06:48,940 --> 00:06:53,010
the incidence is equal to this.

157
00:06:53,010 --> 00:06:54,980
Great, So now we can access

158
00:06:54,980 --> 00:06:57,380
the Audio Manager whenever we need to.

159
00:06:57,380 --> 00:06:59,810
Second, we need a variable in here

160
00:06:59,810 --> 00:07:02,210
which is going to represent all the music that

161
00:07:02,210 --> 00:07:07,820
will have a serialized field, the audio clip.

162
00:07:07,820 --> 00:07:10,220
So why is it audio clip?

163
00:07:10,220 --> 00:07:14,200
Because as we saw right here, where the unity,

164
00:07:14,195 --> 00:07:18,415
when we added the audio source which plays our music,

165
00:07:18,410 --> 00:07:19,760
the music in here,

166
00:07:19,760 --> 00:07:21,800
let's say we add the level music.

167
00:07:21,800 --> 00:07:23,990
You'll see that this is the audio clips,

168
00:07:23,990 --> 00:07:25,400
or we need a reference to

169
00:07:25,400 --> 00:07:28,720
the actual audio clips that we are going to play.

170
00:07:28,715 --> 00:07:31,555
So back and hear

171
00:07:31,550 --> 00:07:35,210
the audio clips and this will be our music.

172
00:07:35,210 --> 00:07:37,250
Just in this case, we will make

173
00:07:37,250 --> 00:07:40,810
the first letter of the variable capital.

174
00:07:40,805 --> 00:07:43,555
And then we are going to do a couple of things.

175
00:07:43,550 --> 00:07:46,030
So what we'll do, as you saw in here,

176
00:07:46,025 --> 00:07:48,685
if he finishes compiling any day now,

177
00:07:48,680 --> 00:07:50,390
you'll remember that when we

178
00:07:50,390 --> 00:07:52,210
added the music to our scene,

179
00:07:52,205 --> 00:07:54,175
we created the audio source.

180
00:07:54,170 --> 00:07:57,620
So for that, we are going to actually create or

181
00:07:57,620 --> 00:08:01,510
add a component which is the audio source,

182
00:08:01,505 --> 00:08:03,835
but something that I did not mention,

183
00:08:03,830 --> 00:08:06,740
and that is how do we actually listen?

184
00:08:06,740 --> 00:08:08,440
So obviously, if you want to

185
00:08:08,435 --> 00:08:10,345
listen to music, you need ears.

186
00:08:10,340 --> 00:08:11,690
You need a listener.

187
00:08:11,690 --> 00:08:13,700
And where is our listener?

188
00:08:13,700 --> 00:08:15,020
While our listener is

189
00:08:15,020 --> 00:08:18,190
usually positioned on the main camera,

190
00:08:18,185 --> 00:08:19,505
you can see right here,

191
00:08:19,505 --> 00:08:21,535
this is a small component of

192
00:08:21,530 --> 00:08:24,100
the camera called the audio listener.

193
00:08:24,095 --> 00:08:26,155
And I can actually turn it off and on

194
00:08:26,150 --> 00:08:28,330
and you can see that it has no properties.

195
00:08:28,325 --> 00:08:30,175
It's just an audio listener.

196
00:08:30,170 --> 00:08:31,520
It's extremely simple.

197
00:08:31,520 --> 00:08:34,910
It's always on the camera by default, so keep it there.

198
00:08:34,910 --> 00:08:35,840
It works.

199
00:08:35,840 --> 00:08:38,020
So back in the Audio Manager,

200
00:08:38,015 --> 00:08:40,225
now we have an Audio Source on it.

201
00:08:40,220 --> 00:08:42,320
And what we'll do as we are going to be

202
00:08:42,320 --> 00:08:44,840
adding the music that we have in here,

203
00:08:44,840 --> 00:08:46,580
the death and the level.

204
00:08:46,580 --> 00:08:49,130
And we are going to be adding them in here.

205
00:08:49,130 --> 00:08:51,800
And every time, for example, we start a level.

206
00:08:51,800 --> 00:08:54,700
We will play the level of music and every time we die,

207
00:08:54,695 --> 00:08:57,295
we will instead remove the clip from

208
00:08:57,290 --> 00:08:59,960
here and add the deaf news.

209
00:08:59,960 --> 00:09:04,030
So we'll need a reference to the audio source.

210
00:09:04,025 --> 00:09:07,945
So private audio source,

211
00:09:07,940 --> 00:09:11,890
and it's going to be called the audio source,

212
00:09:11,885 --> 00:09:15,095
simply like that source.

213
00:09:15,095 --> 00:09:17,815
There we go. And now and start we are going

214
00:09:17,810 --> 00:09:20,570
to get the reference to the audio source is

215
00:09:20,570 --> 00:09:26,560
equal to get Component Audio Source. There we go.

216
00:09:26,555 --> 00:09:27,425
Very simple.

217
00:09:27,425 --> 00:09:31,075
So now let's create a method that will allow us to go

218
00:09:31,070 --> 00:09:35,120
ahead and actually play any kind of level music.

219
00:09:35,120 --> 00:09:36,860
So what we'll do is I'm

220
00:09:36,860 --> 00:09:38,570
going to go in here and I'm going to

221
00:09:38,570 --> 00:09:44,740
create a public void, play level music.

222
00:09:44,735 --> 00:09:47,905
And I'm going to open up the right here.

223
00:09:47,900 --> 00:09:50,510
These two, I always forget what they're called.

224
00:09:50,510 --> 00:09:53,000
And then in here I'm going to say that

225
00:09:53,000 --> 00:09:56,090
the audio source dot the clip.

226
00:09:56,090 --> 00:09:59,630
So you can see the default audio clip to play right here.

227
00:09:59,630 --> 00:10:03,740
Clip is equal to the music.

228
00:10:03,740 --> 00:10:05,760
Open up the two brackets.

229
00:10:05,764 --> 00:10:08,854
And in here we can choose which music we want to play.

230
00:10:08,855 --> 00:10:12,695
So we can see right here that the music one,

231
00:10:12,695 --> 00:10:15,065
the first element is the death,

232
00:10:15,065 --> 00:10:17,095
the second one is the love of music.

233
00:10:17,090 --> 00:10:19,780
So I'm going to choose one in here,

234
00:10:19,775 --> 00:10:22,235
and this will play the music.

235
00:10:22,235 --> 00:10:24,085
But one more thing that we need

236
00:10:24,080 --> 00:10:25,820
to do is we need to actually go ahead

237
00:10:25,820 --> 00:10:28,400
and access the audio source and

238
00:10:28,400 --> 00:10:32,060
actually go ahead and play, save that.

239
00:10:32,060 --> 00:10:36,740
So now we will actually start playing this music.

240
00:10:36,740 --> 00:10:38,510
Let's save that.

241
00:10:38,510 --> 00:10:41,290
And let's see what shall we be doing.

242
00:10:41,285 --> 00:10:43,105
We also need to make sure that as

243
00:10:43,100 --> 00:10:45,320
soon as we start the game right Here,

244
00:10:45,320 --> 00:10:47,960
we go ahead and call

245
00:10:47,960 --> 00:10:51,620
the player that I call this the player level music.

246
00:10:51,620 --> 00:10:54,030
I meant play level music.

247
00:10:54,034 --> 00:11:00,594
So play level, lay level music.

248
00:11:00,590 --> 00:11:04,500
Save that. Back in our game.

249
00:11:04,560 --> 00:11:07,660
So now if we look at the Audio Manager,

250
00:11:07,660 --> 00:11:09,480
you'll see that we don't have any clip,

251
00:11:09,475 --> 00:11:14,475
but when we start the game, There we go.

252
00:11:14,470 --> 00:11:15,700
You can see that now we have

253
00:11:15,700 --> 00:11:17,850
this audio clip and we can run around.

254
00:11:17,845 --> 00:11:21,525
There we go. Now obviously

255
00:11:21,520 --> 00:11:23,790
this is not the most exciting game music.

256
00:11:23,785 --> 00:11:26,605
I believe you will find a much better song to play,

257
00:11:26,605 --> 00:11:28,305
but I think it's good enough and

258
00:11:28,300 --> 00:11:31,260
exciting enough to play around and explore.

259
00:11:31,255 --> 00:11:33,915
So, but that out of the way, let me stop this.

260
00:11:33,910 --> 00:11:36,880
And you can, for example here change the priority.

261
00:11:36,880 --> 00:11:38,350
So what's the priority

262
00:11:38,350 --> 00:11:40,290
between this audio source and another?

263
00:11:40,285 --> 00:11:41,655
This is too detailed.

264
00:11:41,650 --> 00:11:42,820
We won't get into that.

265
00:11:42,820 --> 00:11:44,200
We can change the volume.

266
00:11:44,200 --> 00:11:46,690
So for example, set it at 0.68.

267
00:11:46,690 --> 00:11:48,410
If you think that the music

268
00:11:48,410 --> 00:11:49,730
is too high, change the pitch,

269
00:11:49,730 --> 00:11:51,220
change the stereo pan,

270
00:11:51,215 --> 00:11:53,005
and so on and so forth.

271
00:11:53,000 --> 00:11:56,210
But now, for example, when we died,

272
00:11:56,210 --> 00:11:58,640
if I play around and our life is cubic,

273
00:11:58,640 --> 00:12:00,470
let me just select

274
00:12:00,470 --> 00:12:03,820
the layer and remove this one right here.

275
00:12:03,815 --> 00:12:05,575
Whereas they don't play us on Macs health.

276
00:12:05,570 --> 00:12:07,520
Let's set it to 50.

277
00:12:07,520 --> 00:12:10,960
Run the game, and now we should die immediately.

278
00:12:10,955 --> 00:12:13,715
So there we go. Kill me, please.

279
00:12:13,715 --> 00:12:15,215
There we go, we die.

280
00:12:15,215 --> 00:12:17,045
But the music keeps blink.

281
00:12:17,045 --> 00:12:20,255
So we want to find a solution to this.

282
00:12:20,255 --> 00:12:22,735
I'm going to show it to you as a challenge.

283
00:12:22,730 --> 00:12:26,050
So your challenge is to play the game over music.

284
00:12:26,045 --> 00:12:28,255
So look for music to play

285
00:12:28,250 --> 00:12:30,650
for when the player dies from open game art.

286
00:12:30,650 --> 00:12:33,530
And you can also find a lot of other levels.

287
00:12:33,530 --> 00:12:36,740
And I didn't mention this because I really

288
00:12:36,740 --> 00:12:40,040
didn't bother going through a lot of music.

289
00:12:40,040 --> 00:12:41,180
I just want to make sure we

290
00:12:41,180 --> 00:12:42,670
understand the concept and not

291
00:12:42,665 --> 00:12:45,835
really go and have a lot of songs and play around.

292
00:12:45,830 --> 00:12:47,660
You can, for example,

293
00:12:47,659 --> 00:12:50,569
go in here and instead of just playing the music,

294
00:12:50,570 --> 00:12:53,210
you can add an integer in here which will represent

295
00:12:53,210 --> 00:12:56,120
the music we should play, for example,

296
00:12:56,120 --> 00:12:58,970
and then play that music and for every level

297
00:12:58,970 --> 00:13:02,390
have some kind of music that we play.

298
00:13:02,390 --> 00:13:03,710
Later on you'll see how in

299
00:13:03,710 --> 00:13:06,100
Level Manager we can manage all of that.

300
00:13:06,095 --> 00:13:09,395
But for now, look for some music to play,

301
00:13:09,395 --> 00:13:11,065
especially when the player dies or you

302
00:13:11,060 --> 00:13:13,010
can use the one I've provided you with.

303
00:13:13,010 --> 00:13:15,620
Create a method that plays the game over

304
00:13:15,620 --> 00:13:18,800
song and call the method when we die.

305
00:13:18,800 --> 00:13:20,560
So with that information,

306
00:13:20,555 --> 00:13:25,205
pause the video right now and go do the shallow end.

307
00:13:25,300 --> 00:13:27,590
Okay, welcome back.

308
00:13:27,590 --> 00:13:29,180
How did you get all of that?

309
00:13:29,180 --> 00:13:31,510
So in here, I'm going to go ahead and

310
00:13:31,505 --> 00:13:35,485
play sorry, public void.

311
00:13:35,480 --> 00:13:39,080
Play game.

312
00:13:39,080 --> 00:13:39,980
Oh my God.

313
00:13:39,980 --> 00:13:42,230
Game Over.

314
00:13:42,230 --> 00:13:43,960
Music.

315
00:13:43,955 --> 00:13:47,945
Open up the do whatever they called.

316
00:13:47,945 --> 00:13:50,605
And then in here the audio source,

317
00:13:50,600 --> 00:13:57,320
that clip is equal to music 0.

318
00:13:57,320 --> 00:14:02,600
And in here I'm going to tell the audio source to play.

319
00:14:02,600 --> 00:14:05,110
So save that.

320
00:14:05,105 --> 00:14:07,145
And there is one more thing that we need to do,

321
00:14:07,145 --> 00:14:10,295
and we need to call this whenever the player dice.

322
00:14:10,295 --> 00:14:13,345
So if I go to the player health handler,

323
00:14:13,340 --> 00:14:16,910
if I look through in here and find where we die.

324
00:14:16,910 --> 00:14:20,350
So in here you can see turn on the death screen.

325
00:14:20,345 --> 00:14:23,565
And we said the game object to inactive.

326
00:14:23,569 --> 00:14:28,309
And we also get the audio manager,

327
00:14:28,310 --> 00:14:34,670
dot instance, dot, play game over music.

328
00:14:34,670 --> 00:14:36,020
Save that.

329
00:14:36,020 --> 00:14:38,000
Back end our game.

330
00:14:38,000 --> 00:14:41,450
And here, wait for this to compile.

331
00:14:41,450 --> 00:14:44,690
Run the game for fuel source.

332
00:14:44,690 --> 00:14:47,340
Now, when we die.

333
00:14:48,880 --> 00:14:52,790
Yeah, How cool is that?

334
00:14:52,790 --> 00:14:54,150
Seriously?

335
00:14:54,154 --> 00:14:58,104
Seriously, take a moment to appreciate how amazing

336
00:14:58,100 --> 00:14:59,420
what we've just created

337
00:14:59,420 --> 00:15:01,970
doesn't add more depth to the game,

338
00:15:01,970 --> 00:15:06,230
doesn't add a more feeling of dread doing actually die.

339
00:15:06,230 --> 00:15:10,070
You feel yourself, oh my god, I just died.

340
00:15:10,070 --> 00:15:14,380
That is so bad because of the slight change in the music.

341
00:15:14,375 --> 00:15:15,595
I never really felt

342
00:15:15,590 --> 00:15:18,650
this feeling when I previously died in this game.

343
00:15:18,650 --> 00:15:20,390
Now, what was the music

344
00:15:20,390 --> 00:15:22,310
changing with the atmosphere changing?

345
00:15:22,310 --> 00:15:24,790
I feel like I've just then destroy it

346
00:15:24,785 --> 00:15:27,815
because I really like the music change.

347
00:15:27,815 --> 00:15:29,185
I hope you felt This also.

348
00:15:29,180 --> 00:15:31,880
I hope you enjoyed and something that we need to

349
00:15:31,880 --> 00:15:35,110
make sure we do in here when we commit our changes.

350
00:15:35,105 --> 00:15:36,665
And the day now,

351
00:15:36,665 --> 00:15:38,875
if you please can show me.

352
00:15:38,870 --> 00:15:42,010
So come on any day now,

353
00:15:42,005 --> 00:15:43,495
let's see in here we have

354
00:15:43,490 --> 00:15:46,150
the committed changes that we want to do.

355
00:15:46,145 --> 00:15:48,695
But we need to make sure to ignore

356
00:15:48,695 --> 00:15:51,205
everything under the all your assets.

357
00:15:51,200 --> 00:15:55,840
So if I ignore everything on the assets,

358
00:15:55,835 --> 00:15:58,855
all DO because we don't want to save the audio.

359
00:15:58,850 --> 00:16:02,150
It just takes up a lot of space and not that practical.

360
00:16:02,149 --> 00:16:04,099
So now we stage all,

361
00:16:04,100 --> 00:16:08,290
commit our changes and created

362
00:16:08,285 --> 00:16:13,205
and all your manager that plays

363
00:16:13,205 --> 00:16:18,065
music or plays level music

364
00:16:18,065 --> 00:16:23,645
and music using all of your source.

365
00:16:23,645 --> 00:16:25,865
There we go, commit our changes.

366
00:16:25,865 --> 00:16:27,445
I hope you enjoy it and I'll see you in

367
00:16:27,440 --> 00:16:28,790
the next video where we will

368
00:16:28,790 --> 00:16:30,230
be playing the sound effects,

369
00:16:30,230 --> 00:16:33,970
which is a bit more fun maybe than music.

370
00:16:33,965 --> 00:16:36,095
So I'll see you.

