1
00:00:00,800 --> 00:00:05,430
Welcome back, My favorite game developers.

2
00:00:05,430 --> 00:00:09,880
As you can see now we have three enemies, x2, very scary.

3
00:00:09,884 --> 00:00:11,554
Let me maximize on play.

4
00:00:11,550 --> 00:00:14,220
And we have a wrong with not only have doors,

5
00:00:14,220 --> 00:00:15,630
we also have enemies,

6
00:00:15,630 --> 00:00:17,460
which are three skeletons.

7
00:00:17,460 --> 00:00:21,930
These skeletons are the guys we need to kill in order to open the doors.

8
00:00:21,930 --> 00:00:26,780
But for now what we do is we just catch them in the act using a list.

9
00:00:26,775 --> 00:00:28,785
So I've maximized on play,

10
00:00:28,785 --> 00:00:30,525
I should not have done that.

11
00:00:30,525 --> 00:00:32,345
I'm now going to run again.

12
00:00:32,340 --> 00:00:36,210
If I look in the rooms and today now,

13
00:00:36,205 --> 00:00:40,855
I can see that I have the enemies right here and I have the two doors,

14
00:00:40,850 --> 00:00:44,570
but the magic is that we caught them without adding them manually.

15
00:00:44,570 --> 00:00:48,550
You can see that it happens automatically using contact filters,

16
00:00:48,545 --> 00:00:51,445
using lists, using a lot of cool stuff.

17
00:00:51,440 --> 00:00:55,280
So let's not waste any more time and let's get started.

18
00:00:55,280 --> 00:00:56,810
Oh, case.

19
00:00:56,810 --> 00:00:59,590
So now we have the doors closing.

20
00:00:59,585 --> 00:01:03,205
It's time to start opening them up.

21
00:01:03,200 --> 00:01:05,300
How do we open up the doors?

22
00:01:05,300 --> 00:01:09,050
The way we will allow them to open is when we get

23
00:01:09,050 --> 00:01:13,490
rid of all the enemies that we have in the current map.

24
00:01:13,490 --> 00:01:16,310
So what we're going to do is we're going to

25
00:01:16,310 --> 00:01:20,140
create a variable which will first of all make sure that the,

26
00:01:20,135 --> 00:01:22,985
all the doors open when all the enemies are killed.

27
00:01:22,985 --> 00:01:28,535
Maybe just maybe the level that you created doesn't have to kill all the enemies.

28
00:01:28,535 --> 00:01:30,625
Maybe it's a level for the shop,

29
00:01:30,620 --> 00:01:32,840
for example, just like we had in Hades.

30
00:01:32,840 --> 00:01:35,300
So that's why we'll add this variable.

31
00:01:35,300 --> 00:01:37,160
So let's get started.

32
00:01:37,159 --> 00:01:39,679
So in here we have the enemy controller.

33
00:01:39,680 --> 00:01:42,390
As you can see, I've organized everything.

34
00:01:42,394 --> 00:01:45,444
Anyways, let's not waste time because in the wrong manager,

35
00:01:45,440 --> 00:01:48,130
we are going to add the volume right here.

36
00:01:48,125 --> 00:01:53,645
And that is to open or open doors.

37
00:01:53,645 --> 00:01:59,585
When and and me is dy.

38
00:01:59,585 --> 00:02:01,405
There you go. We save that.

39
00:02:01,400 --> 00:02:04,700
We'll go back in here and we'll make sure to set this,

40
00:02:04,700 --> 00:02:09,170
this particular room to true open when enemies die.

41
00:02:09,170 --> 00:02:10,120
Okay, great.

42
00:02:10,115 --> 00:02:14,995
Next thing we need to do is we need to get a reference of all the enemies.

43
00:02:14,990 --> 00:02:16,420
Well, how do we do that?

44
00:02:16,415 --> 00:02:18,475
We will have obviously multiple enemies.

45
00:02:18,470 --> 00:02:23,750
That means we will have to most likely get some sort of array.

46
00:02:23,750 --> 00:02:27,250
But why we don't want to use an array?

47
00:02:27,245 --> 00:02:29,285
Because when we have an array,

48
00:02:29,285 --> 00:02:31,315
how am I going to demonstrate this?

49
00:02:31,310 --> 00:02:33,530
So for example, you can see right here,

50
00:02:33,530 --> 00:02:35,960
if I click on one of those arrays right here,

51
00:02:35,960 --> 00:02:37,770
and if I use the minus,

52
00:02:37,774 --> 00:02:41,734
this will simply remove the door from our game.

53
00:02:41,735 --> 00:02:44,575
It does not actually delete the entire element.

54
00:02:44,570 --> 00:02:47,990
So we still have two doors right here,

55
00:02:47,990 --> 00:02:49,780
but one of them is missing.

56
00:02:49,775 --> 00:02:51,575
Now when it comes to the door,

57
00:02:51,575 --> 00:02:56,455
this is not a huge problem because we already know that we will have only two doors.

58
00:02:56,450 --> 00:02:58,220
We are not going to count them.

59
00:02:58,220 --> 00:03:00,080
We are not going to get rid of them.

60
00:03:00,080 --> 00:03:02,030
They are there, they are static,

61
00:03:02,030 --> 00:03:03,440
they are not moving.

62
00:03:03,440 --> 00:03:05,500
But when it comes to the enemies,

63
00:03:05,495 --> 00:03:09,865
what we want is we want to get a reference to all the enemies in the map.

64
00:03:09,860 --> 00:03:12,950
And then as we slowly kill them one by one,

65
00:03:12,950 --> 00:03:14,620
we are going to count them.

66
00:03:14,615 --> 00:03:17,665
And if we find that all of them have disappeared,

67
00:03:17,660 --> 00:03:19,210
then we will open the door.

68
00:03:19,205 --> 00:03:22,915
And this will cause a problem when we are using a rate.

69
00:03:22,910 --> 00:03:26,870
That's why we are going to use something a bit better,

70
00:03:26,870 --> 00:03:29,320
which is the list.

71
00:03:29,315 --> 00:03:32,495
So a list is just like an array.

72
00:03:32,495 --> 00:03:35,345
It represents a strongly typed list of objects.

73
00:03:35,345 --> 00:03:40,055
And by the way, this is the documentations of Microsoft for the C-sharp,

74
00:03:40,055 --> 00:03:42,085
not the Unity documentation,

75
00:03:42,080 --> 00:03:43,730
but it's pretty much the same.

76
00:03:43,730 --> 00:03:44,840
You can find examples,

77
00:03:44,840 --> 00:03:48,440
you can find what ever you want and lists

78
00:03:48,440 --> 00:03:53,000
the great thing about them as they are much better at sorting,

79
00:03:53,000 --> 00:03:57,140
they are much better at sorting through and manipulating.

80
00:03:57,140 --> 00:04:00,560
So what we can do is as each enemy dies,

81
00:04:00,560 --> 00:04:05,420
we can remove him from the list without worrying about any kinds of error,

82
00:04:05,420 --> 00:04:07,660
the list will adjust itself.

83
00:04:07,655 --> 00:04:13,165
So that explained, I will let you find the list,

84
00:04:13,160 --> 00:04:16,400
the class, find the documentation of this.

85
00:04:16,400 --> 00:04:21,010
And I'm going to issue you the challenge again just like the last challenge I know.

86
00:04:21,005 --> 00:04:26,005
So annoying when you have to do something by yourself without seeing what I did first.

87
00:04:26,000 --> 00:04:28,580
But it's time to grow up,

88
00:04:28,580 --> 00:04:31,010
time to become real game developers,

89
00:04:31,010 --> 00:04:35,200
look for problems and do things that we have never encountered before.

90
00:04:35,195 --> 00:04:36,565
This is the beauty of it.

91
00:04:36,560 --> 00:04:41,560
Look through the documentation and find how we can instantiate a new.

92
00:04:41,555 --> 00:04:44,665
Let's create a serialized field list.

93
00:04:44,660 --> 00:04:46,630
We want to see the list in the inspector.

94
00:04:46,625 --> 00:04:49,975
Later on, we obviously need to make it private,

95
00:04:49,970 --> 00:04:52,840
but we want to check if everything is working.

96
00:04:52,835 --> 00:05:00,245
And finally, the type of the list will be a collider to D. So find the documentation,

97
00:05:00,245 --> 00:05:03,275
go through it, create a new list,

98
00:05:03,275 --> 00:05:07,105
which is the list of enemies of type collider 2D.

99
00:05:07,100 --> 00:05:09,500
I'll see you in just a bit.

100
00:05:09,500 --> 00:05:12,050
Okay, welcome back.

101
00:05:12,050 --> 00:05:13,960
So how did you get on that?

102
00:05:13,955 --> 00:05:15,865
I hope you're not too angry at me.

103
00:05:15,860 --> 00:05:19,310
Anyways, let's go ahead and create a serialized field.

104
00:05:19,310 --> 00:05:21,970
And this is going to be a list.

105
00:05:21,965 --> 00:05:23,965
And as you can see, well,

106
00:05:23,960 --> 00:05:25,280
you saw in the example,

107
00:05:25,280 --> 00:05:27,860
let's just double-check and see how it's created.

108
00:05:27,860 --> 00:05:31,760
So you can see it needs the systems dot collections,

109
00:05:31,760 --> 00:05:33,010
which is right here.

110
00:05:33,005 --> 00:05:37,295
Oops, sorry, which is right here that allows us to create lists.

111
00:05:37,295 --> 00:05:40,355
Let's go see what we have in here.

112
00:05:40,355 --> 00:05:41,905
Let's say I'm scrolling down,

113
00:05:41,900 --> 00:05:43,550
how do you create lists, please?

114
00:05:43,550 --> 00:05:45,350
How do I create a list?

115
00:05:45,350 --> 00:05:49,410
Where is it? Where is it?

116
00:05:49,930 --> 00:05:51,890
Okay, So there you go.

117
00:05:51,890 --> 00:05:53,510
This is how you create a list.

118
00:05:53,510 --> 00:05:58,550
So we need to type in the type of this that we have inside these two unnatural,

119
00:05:58,550 --> 00:06:02,180
what they're called and say that it's equal to a new list.

120
00:06:02,180 --> 00:06:04,030
So back in here,

121
00:06:04,025 --> 00:06:07,835
the type collider 2D,

122
00:06:07,835 --> 00:06:09,445
I've already told you that.

123
00:06:09,440 --> 00:06:12,680
And you'll see why it's a collider 2D in just a bit.

124
00:06:12,680 --> 00:06:15,110
So enemies, and it's equal to

125
00:06:15,110 --> 00:06:22,600
a new list of Collider to the enemies and we close it off with these two parentheses.

126
00:06:22,595 --> 00:06:26,645
Now, obviously it took you just a little bit more time to find everything,

127
00:06:26,645 --> 00:06:29,195
maybe look through the documentation, but that's good.

128
00:06:29,195 --> 00:06:33,025
Now you can say that proudly that shoe look through

129
00:06:33,020 --> 00:06:36,920
the documentation found out by yourself how lists are created,

130
00:06:36,920 --> 00:06:39,290
and this will give you much more confidence

131
00:06:39,290 --> 00:06:41,890
as you move through your game development journey.

132
00:06:41,885 --> 00:06:43,595
I'm not always going to be here.

133
00:06:43,595 --> 00:06:47,275
Sometimes I won't be sometimes I'm don't have the time to answer you.

134
00:06:47,270 --> 00:06:49,700
So this is a great exercise.

135
00:06:49,700 --> 00:06:51,140
I love these exercises.

136
00:06:51,140 --> 00:06:52,270
I hope you're not too angry.

137
00:06:52,265 --> 00:06:55,025
Let's continue on. What do we need to do right now?

138
00:06:55,025 --> 00:06:58,315
We need to go into the rooms right here

139
00:06:58,310 --> 00:07:01,460
and we're going to create a new empty game object,

140
00:07:01,460 --> 00:07:03,740
which will be the enemies.

141
00:07:03,739 --> 00:07:06,729
And this will hold all the enemies that we have.

142
00:07:06,725 --> 00:07:11,375
The skeleton enemy right here that C does he need anything?

143
00:07:11,375 --> 00:07:12,965
Also the shooting range.

144
00:07:12,965 --> 00:07:18,335
Let's make it a bit smaller so we don't want the enemies to shoot us.

145
00:07:18,335 --> 00:07:19,895
We know everything works.

146
00:07:19,895 --> 00:07:22,225
That's good and we are going to make their health.

147
00:07:22,220 --> 00:07:24,170
But smaller, maybe three.

148
00:07:24,170 --> 00:07:27,760
So he takes three hits, apply the changes.

149
00:07:27,755 --> 00:07:30,995
And I'm going to move him to the enemies.

150
00:07:30,995 --> 00:07:35,515
I'm going to also go into the Prefabs and add a couple of enemies.

151
00:07:35,510 --> 00:07:38,510
And here, so the enemy,

152
00:07:38,510 --> 00:07:41,480
the skeleton will adding another one.

153
00:07:41,480 --> 00:07:45,380
Here. Another one, so great.

154
00:07:45,380 --> 00:07:50,410
Now we have three skeletons roaming around that will chase and shoot the player.

155
00:07:50,405 --> 00:07:51,455
We will save that.

156
00:07:51,455 --> 00:07:52,525
Okay, great.

157
00:07:52,520 --> 00:07:56,660
Now the next thing that we want to do is we want to get the,

158
00:07:56,660 --> 00:07:59,750
a reference to all those enemies and be able to count them.

159
00:07:59,750 --> 00:08:01,460
Now what we can do, obviously,

160
00:08:01,460 --> 00:08:02,480
as we can go ahead,

161
00:08:02,480 --> 00:08:05,960
select these three and drag them in here and set them manually.

162
00:08:05,960 --> 00:08:07,960
That would be good,

163
00:08:07,955 --> 00:08:09,745
that would be working.

164
00:08:09,740 --> 00:08:14,630
But we want to have a more dynamic way of accessing these enemies.

165
00:08:14,630 --> 00:08:19,090
One of those dynamic ways is using find objects of type,

166
00:08:19,085 --> 00:08:22,795
where we go through all the objects and we find all of them.

167
00:08:22,790 --> 00:08:24,560
This is also a good idea,

168
00:08:24,560 --> 00:08:27,590
but it is very taxing on the system.

169
00:08:27,590 --> 00:08:29,990
You have to go through all the elements,

170
00:08:29,990 --> 00:08:32,900
starting from the camera and down until you

171
00:08:32,900 --> 00:08:37,610
find all of these enemies of type or object of type.

172
00:08:37,610 --> 00:08:39,370
We're not going to do that.

173
00:08:39,365 --> 00:08:43,795
Instead, we are going to do something much more complicated at first,

174
00:08:43,790 --> 00:08:47,800
but much more effective and less taxing on the system.

175
00:08:47,795 --> 00:08:51,145
And it's a great way to learn something very new.

176
00:08:51,140 --> 00:08:53,110
And we already have the,

177
00:08:53,105 --> 00:08:56,545
let's say the infrastructure for that established by having

178
00:08:56,540 --> 00:09:00,250
the colliders of the enemies and the collider of the room.

179
00:09:00,245 --> 00:09:01,855
So what am I talking about?

180
00:09:01,850 --> 00:09:02,660
You just saw it.

181
00:09:02,660 --> 00:09:06,160
It's the collider, 2D overlap collider.

182
00:09:06,155 --> 00:09:07,315
What does this do?

183
00:09:07,310 --> 00:09:09,050
It takes in a contact filter,

184
00:09:09,050 --> 00:09:11,260
which we will look at in just a bit.

185
00:09:11,255 --> 00:09:15,265
And it gives us the results of all the collider 2D objects.

186
00:09:15,260 --> 00:09:19,930
So a contact filter used to filter the results differently.

187
00:09:19,925 --> 00:09:21,835
What do we mean by that?

188
00:09:21,830 --> 00:09:25,360
We mean that we have the collider of the room right here.

189
00:09:25,355 --> 00:09:27,245
So we have the collider,

190
00:09:27,244 --> 00:09:29,524
we have all the objects inside.

191
00:09:29,525 --> 00:09:31,315
We don't want to catch the player,

192
00:09:31,310 --> 00:09:34,540
for example, we are only interested in the skeletons.

193
00:09:34,535 --> 00:09:39,215
So we need to add this contact filter that will understand how it's used.

194
00:09:39,215 --> 00:09:40,685
But let's continue on.

195
00:09:40,685 --> 00:09:42,635
So contact filter and the result,

196
00:09:42,635 --> 00:09:44,575
that result, It's the array.

197
00:09:44,570 --> 00:09:46,210
To receive the results.

198
00:09:46,205 --> 00:09:47,455
We can use an array,

199
00:09:47,450 --> 00:09:50,380
we can use also a list.

200
00:09:50,375 --> 00:09:52,135
Don't worry about that.

201
00:09:52,130 --> 00:09:53,630
Let's continue one.

202
00:09:53,630 --> 00:09:54,290
What do we need?

203
00:09:54,290 --> 00:09:58,580
So it returns the number of results if we want a return,

204
00:09:58,580 --> 00:10:02,030
and then we are going to check what is a contact filter.

205
00:10:02,030 --> 00:10:05,330
So I'm giving you all the ways of how we create.

206
00:10:05,330 --> 00:10:08,750
So honestly, I had no idea what a contact filter was.

207
00:10:08,750 --> 00:10:12,440
This is the first time I encountered when I was creating this game,

208
00:10:12,440 --> 00:10:15,710
even though I've had a lot of experience in game development,

209
00:10:15,710 --> 00:10:19,030
this is really the first time that I actually used it into the,

210
00:10:19,025 --> 00:10:21,305
so I went and looked for it.

211
00:10:21,305 --> 00:10:24,245
Okay, So look, we have a lot of properties.

212
00:10:24,245 --> 00:10:26,065
And if you go back,

213
00:10:26,060 --> 00:10:28,700
we can see right here results differently.

214
00:10:28,700 --> 00:10:30,500
And what else do we have?

215
00:10:30,500 --> 00:10:33,020
We have something called bi layer mask.

216
00:10:33,020 --> 00:10:35,170
I know what layer mask is,

217
00:10:35,165 --> 00:10:37,765
so I have to look and I find.

218
00:10:37,760 --> 00:10:39,650
Set Layer Mask, excellent.

219
00:10:39,650 --> 00:10:44,900
This sets the layer mask based on some kind of provided a parameter or something.

220
00:10:44,900 --> 00:10:46,180
Great. I click on it,

221
00:10:46,175 --> 00:10:48,355
I see contact filter, layer mask.

222
00:10:48,350 --> 00:10:50,020
I give it a layer mask.

223
00:10:50,015 --> 00:10:54,485
I know what the layer mask is and I'll show you how we are going to use it.

224
00:10:54,485 --> 00:10:58,045
But anyways, these are the steps that even I sometimes take.

225
00:10:58,040 --> 00:10:59,960
So don't think that NEW,

226
00:10:59,960 --> 00:11:02,290
don't remember everything and you should know,

227
00:11:02,285 --> 00:11:04,585
no, you should do your own research.

228
00:11:04,580 --> 00:11:09,260
Always look through the documentation and now let's go ahead and get started.

229
00:11:09,260 --> 00:11:13,150
So I'm going to go back in here and I'm going to create, first of all,

230
00:11:13,145 --> 00:11:18,445
a private collider 2D,

231
00:11:18,440 --> 00:11:22,910
and this will be the room collider.

232
00:11:22,910 --> 00:11:24,010
Save that.

233
00:11:24,005 --> 00:11:27,205
And then a, another private contact

234
00:11:27,200 --> 00:11:30,860
filtered to D and it's going to be the contact filter to D.

235
00:11:30,860 --> 00:11:32,900
I'll just keep the name as it is.

236
00:11:32,900 --> 00:11:34,450
So now and start,

237
00:11:34,445 --> 00:11:35,875
what are we going to do?

238
00:11:35,870 --> 00:11:39,160
Well, first of all, we need a reference to the room collider.

239
00:11:39,155 --> 00:11:43,285
So room collider is equal to get components.

240
00:11:43,280 --> 00:11:47,270
And it's going to be the collider 2D.

241
00:11:47,270 --> 00:11:51,290
Great, So now we have a reference to the collider on the room.

242
00:11:51,290 --> 00:11:56,030
Next thing we want to do is we want to get the contact filter 2D.

243
00:11:56,030 --> 00:12:00,290
And we're going to set the layer mask just like we saw.

244
00:12:00,290 --> 00:12:03,350
And what did we say we need inside of the set Layer Mask,

245
00:12:03,350 --> 00:12:05,140
we need the Layer Mask.

246
00:12:05,135 --> 00:12:06,865
How do we get the layer mask?

247
00:12:06,860 --> 00:12:08,570
Well, we know what layer is,

248
00:12:08,570 --> 00:12:09,940
but what is the mask?

249
00:12:09,935 --> 00:12:14,715
The mask is a way to let us say to convert,

250
00:12:14,719 --> 00:12:16,989
to understand what the layers are.

251
00:12:16,985 --> 00:12:18,775
So what can we do?

252
00:12:18,770 --> 00:12:21,800
We can use something called the layer mask.

253
00:12:21,800 --> 00:12:26,560
And we can use a method in here that says to get the mask.

254
00:12:26,555 --> 00:12:28,465
And how do we get the mask?

255
00:12:28,460 --> 00:12:31,040
We can get it actually buy the layers name.

256
00:12:31,040 --> 00:12:34,300
Great, so now we have access to the layer's name.

257
00:12:34,295 --> 00:12:37,075
And what does the layer, it's the enemy.

258
00:12:37,070 --> 00:12:39,350
And because this is a string reference,

259
00:12:39,350 --> 00:12:42,070
makes sure that shoe have potted correctly,

260
00:12:42,065 --> 00:12:44,105
go even copy it if you have to.

261
00:12:44,105 --> 00:12:46,265
But what's happening in here,

262
00:12:46,265 --> 00:12:47,765
we got the layer name.

263
00:12:47,765 --> 00:12:49,405
We use the get mask,

264
00:12:49,400 --> 00:12:53,290
which is a method available in the layer mask library.

265
00:12:53,285 --> 00:13:00,775
We use this whole layer mask and set the layer mask on the contact filter.

266
00:13:00,770 --> 00:13:02,680
Complicated, I know.

267
00:13:02,675 --> 00:13:10,105
And now we use the room collider, thought overlap collider.

268
00:13:10,100 --> 00:13:11,780
And in here, what did we need?

269
00:13:11,780 --> 00:13:13,900
We need the compact filter to the,

270
00:13:13,895 --> 00:13:15,205
what are the results?

271
00:13:15,200 --> 00:13:17,180
Where do we want to throw our results?

272
00:13:17,180 --> 00:13:18,560
And you can see right here the arrow,

273
00:13:18,560 --> 00:13:20,080
if you click it, there you go.

274
00:13:20,075 --> 00:13:25,445
You can add it to a list or we can add it to a collider 2D based on what we give it.

275
00:13:25,445 --> 00:13:27,725
So if we give it an array in here,

276
00:13:27,725 --> 00:13:29,575
then this result will be an array.

277
00:13:29,570 --> 00:13:32,750
But because we're giving it currently a list,

278
00:13:32,750 --> 00:13:37,340
this will be as a list, save that record.

279
00:13:37,340 --> 00:13:40,750
So again, let's go through this one more time.

280
00:13:40,745 --> 00:13:42,685
We created a contact filter.

281
00:13:42,680 --> 00:13:46,450
We understood what contact filters are through the unit documentations.

282
00:13:46,445 --> 00:13:48,595
We've added a collider 2D.

283
00:13:48,590 --> 00:13:49,730
That's very simple.

284
00:13:49,730 --> 00:13:52,220
We got a reference using the get component.

285
00:13:52,220 --> 00:13:53,860
We already know how we do that.

286
00:13:53,855 --> 00:13:55,885
We access the contact filter.

287
00:13:55,880 --> 00:13:58,880
We use a method called the Set Layer Mask.

288
00:13:58,880 --> 00:14:01,090
This set Layer Mask requires a,

289
00:14:01,085 --> 00:14:03,055
something called a layer mask,

290
00:14:03,050 --> 00:14:05,410
not just a layer, a layer mask.

291
00:14:05,405 --> 00:14:07,145
So what we do,

292
00:14:07,145 --> 00:14:09,215
we looked for get Layer Mask.

293
00:14:09,215 --> 00:14:12,665
And this will actually be a sight challenge to you.

294
00:14:12,665 --> 00:14:15,035
Go look for Layer Mask,

295
00:14:15,035 --> 00:14:18,335
get Layer Mask and stand how we found this method.

296
00:14:18,335 --> 00:14:21,215
So this is a whole different process.

297
00:14:21,215 --> 00:14:22,915
We use the get layer mask,

298
00:14:22,910 --> 00:14:27,040
which is part of the layer mask and Unity engine layer mask,

299
00:14:27,035 --> 00:14:29,245
and we use the name of the enemy layer.

300
00:14:29,240 --> 00:14:33,680
So now what happens as soon as this room manager starts?

301
00:14:33,680 --> 00:14:36,440
First of all, on Trigger Enter it finds the enemy.

302
00:14:36,440 --> 00:14:40,540
Second of all, it looks through all the enemies that are already here.

303
00:14:40,535 --> 00:14:44,725
And as I've said, there are many ways of catching the enemies.

304
00:14:44,720 --> 00:14:46,390
There is find objects of type.

305
00:14:46,385 --> 00:14:48,475
We can have used the entrepreneur enter,

306
00:14:48,470 --> 00:14:52,570
but I thought this is a great opportunity to learn about lists.

307
00:14:52,565 --> 00:14:55,855
Learn about contact filter in never know when.

308
00:14:55,850 --> 00:14:58,970
Sometimes you might find yourself in a situation and

309
00:14:58,970 --> 00:15:02,710
programming where you just can't do it without a contact filter.

310
00:15:02,705 --> 00:15:05,015
So save all of that.

311
00:15:05,015 --> 00:15:09,595
We go back into Unity and let's look at our enemies now as soon as we run,

312
00:15:09,590 --> 00:15:11,420
we should see the three enemies here.

313
00:15:11,420 --> 00:15:13,910
Hopefully run the game.

314
00:15:13,910 --> 00:15:16,190
There we go. Excellent.

315
00:15:16,190 --> 00:15:19,510
And you can see that we've got all the colliders of skeleton one,

316
00:15:19,505 --> 00:15:22,145
skeleton to and skeleton three,

317
00:15:22,145 --> 00:15:23,845
or however you want to call it.

318
00:15:23,840 --> 00:15:26,780
Excellent, We have a reference to them.

319
00:15:26,780 --> 00:15:30,110
So now the next step is to kill all of them

320
00:15:30,110 --> 00:15:33,710
and open the doors with blue that in the next video,

321
00:15:33,710 --> 00:15:36,140
make sure to complete your changes.

322
00:15:36,140 --> 00:15:42,360
Make sure to leave a review and I'll see you in the next video.

