WEBVTT

00:00.040 --> 00:01.040
Now what we will do.

00:01.080 --> 00:04.120
We are just gonna damage our player game object.

00:04.120 --> 00:09.840
Basically what we want to do if we select our enemy to GameObject in the hierarchy, then move over

00:09.840 --> 00:13.480
to the animation tab and select the Attack Animation clip.

00:13.600 --> 00:16.240
As you can see right over here.

00:16.240 --> 00:19.520
So we will create a attack point somewhere around here.

00:19.680 --> 00:22.600
And from that point we are just going to create a circle.

00:22.600 --> 00:27.760
And if that circle collide with this player game object, then this player game object just gonna take

00:27.800 --> 00:28.400
damage.

00:28.760 --> 00:32.400
So we will do the same thing as we have done with player attack.

00:32.560 --> 00:36.720
So we are gonna do the same thing or we're gonna approach the same way.

00:37.040 --> 00:40.560
So we're gonna create a attack point somewhere around here.

00:40.560 --> 00:43.640
And from that point we just want to create the circle.

00:43.640 --> 00:47.160
So let's open up our enemy two script by double clicking on it.

00:47.560 --> 00:51.200
And let's let's make it over here.

00:51.600 --> 00:55.280
Uh, we're going to make it somewhere around here.

00:55.400 --> 00:56.000
It does.

00:56.160 --> 00:59.280
It doesn't need to uh, doesn't need to be in order.

00:59.350 --> 01:01.350
You can make it anywhere you like.

01:01.390 --> 01:04.910
It's basically up to you and we will make that function.

01:04.950 --> 01:06.750
We will make this function public.

01:06.750 --> 01:07.150
Why?

01:07.310 --> 01:11.750
Because we're going to call this function through animation event basically right over here.

01:11.750 --> 01:13.230
It's going to be perfect time.

01:13.230 --> 01:15.310
So we will call the function here.

01:15.310 --> 01:16.190
So that's why.

01:16.350 --> 01:18.590
So we're going to mark this function as public.

01:18.790 --> 01:20.630
For function we're going to type void.

01:20.630 --> 01:22.550
And we have to name the function.

01:22.550 --> 01:24.510
So we're going to call it something like attack.

01:24.550 --> 01:27.430
Let's make first bracket and some curly brackets.

01:27.430 --> 01:32.470
So inside this function what we want to do we want to create a circle from that point.

01:32.470 --> 01:39.390
And we do know that to create a circle we need to use this physics 2D physics 2D dot overlap.

01:39.510 --> 01:43.950
Sorry uh sorry overlap circle function.

01:43.950 --> 01:48.830
And we do know that this function as a first argument, it's going to take the point from where we want

01:48.830 --> 01:50.190
to create the circle.

01:50.190 --> 01:52.630
So we need to create an empty game object.

01:52.630 --> 01:55.990
And we can just name that to something like point attack point.

01:55.990 --> 01:58.660
And the second thing it's going to take the radius.

01:58.660 --> 02:04.340
And the third argument it's going to take the layer mask basically which game object we want to damage.

02:04.340 --> 02:07.860
So let's make this one a comment by double forward slash.

02:07.860 --> 02:09.780
And let's go to the top of our class.

02:09.780 --> 02:12.020
And let's assign those variable.

02:12.020 --> 02:16.700
So we're going to make it somewhere over here uh somewhere over here.

02:16.700 --> 02:19.220
So let's give it a header or title.

02:19.220 --> 02:20.620
Let's give it a title.

02:20.780 --> 02:23.020
And we're going to say something like attack.

02:23.700 --> 02:25.020
Uh, let's say attack.

02:25.180 --> 02:26.220
So what we need.

02:26.460 --> 02:28.540
Uh, so let's make a serialized file.

02:28.540 --> 02:31.340
So we need position basically means transform.

02:31.340 --> 02:38.300
So when I create a private transform and make sure you just mark as serialized, you can, uh, so you

02:38.300 --> 02:43.100
can notice underneath your inspector tab, underneath your enemy to script.

02:43.100 --> 02:46.060
And we're going to call this one something like attack point.

02:46.260 --> 02:48.460
And the second thing we need the radius.

02:48.460 --> 02:51.500
So let's make a another serialized field private.

02:51.700 --> 02:54.460
And we're going to call this one attack radius.

02:54.740 --> 02:55.300
Sorry.

02:55.340 --> 02:57.760
Let's call it attack Radius.

02:57.760 --> 03:04.120
And by default I'm going to set something around one unit one if something like that.

03:04.120 --> 03:06.120
Sorry we need to type this float.

03:06.560 --> 03:10.480
So let's type this float equal to then attack radius.

03:10.640 --> 03:13.080
And by default I have given one f.

03:13.120 --> 03:14.320
As you can notice.

03:14.560 --> 03:17.280
And we also need to assign the layer masks.

03:17.280 --> 03:22.360
But we already already created right over here as you can see.

03:22.560 --> 03:26.720
And we just we just created a field called What is player.

03:26.720 --> 03:29.880
So we can make it one more time layer mask.

03:29.880 --> 03:34.360
But I'm going to use the old one since we just going to damage our player.

03:34.360 --> 03:36.520
So this what is player layer masks.

03:36.520 --> 03:38.200
We assign it that player.

03:38.200 --> 03:44.160
So that's why I'm not going to create it one more time since this since we already have it.

03:44.200 --> 03:46.600
Basically we want to damage our player.

03:46.600 --> 03:49.920
And over here layer Mask we just assign it player.

03:50.200 --> 03:54.400
And what we're going to do now we're going to press down Ctrl S to save our script.

03:54.400 --> 03:54.470
scrape.

03:54.510 --> 03:56.310
And now let's head over to unity.

03:56.510 --> 04:01.510
So as soon as our enemy two script just gonna compile those, we're just gonna pop up.

04:01.510 --> 04:06.510
So first thing, we'll pop up a attack point and by default, and it's gonna be empty.

04:06.830 --> 04:07.670
So now.

04:07.870 --> 04:14.990
So if I select my enemy two GameObject in the hierarchy, then go over to Inspector Enemy two script.

04:15.030 --> 04:17.150
As you can see, it will be none.

04:17.150 --> 04:18.710
Sorry, sorry.

04:18.710 --> 04:21.310
We didn't, uh, basically saved our code.

04:21.310 --> 04:27.270
We need to move over to script one more time, and let's press down control s one more time in order

04:27.270 --> 04:28.630
to save our script.

04:28.790 --> 04:30.830
And now let's move over to unity.

04:30.830 --> 04:32.550
So now it's gonna be fine.

04:32.550 --> 04:37.310
So we will see a attack title underneath our enemy two script in Inspector.

04:37.310 --> 04:40.310
And we need to assign those variables one by one.

04:40.310 --> 04:42.710
So the first thing we need a attack point.

04:42.710 --> 04:48.510
So we will create an empty game object inside this enemy game object in the hierarchy.

04:48.790 --> 04:52.270
And we're going to call that GameObject to something like attack point.

04:52.270 --> 04:55.740
And from that point we just want to create the circle.

04:55.740 --> 04:56.580
So that's why.

04:56.980 --> 05:03.220
So just wait a moment and once the compilation is done, we can just go ahead and we can just assign

05:03.220 --> 05:05.060
those variables one by one.

05:05.340 --> 05:12.540
So if we move over to Inspector Animator script, we can see in the bottom a tag title pop pop up and

05:12.580 --> 05:13.220
attack point.

05:13.220 --> 05:16.420
As you can see it says none transform basically empty.

05:16.620 --> 05:18.300
So let's create a attack point.

05:18.300 --> 05:21.020
So let's select the enemy to GameObject in the hierarchy.

05:21.060 --> 05:24.580
Let's right click on it and create an empty game object.

05:24.580 --> 05:28.020
And you can name that game object to something like Attack Point.

05:28.020 --> 05:30.060
So I'm going to call it Attack point.

05:30.220 --> 05:32.180
So let's call it Attack point.

05:32.380 --> 05:38.020
And I'm going to choose an gizmos for it to do to to choose that we will go over to Inspector.

05:38.020 --> 05:40.420
Let's click here in this box.

05:40.420 --> 05:42.740
And we're going to choose an gizmos for it.

05:42.740 --> 05:44.100
So I'm going to choose yellow.

05:44.300 --> 05:47.380
And we're going to select our move tool from the scene view.

05:47.540 --> 05:49.780
And let's move it somewhere around here.

05:49.780 --> 05:54.610
But before you move make sure I'm going to select my enemy to GameObject first.

05:54.610 --> 05:58.370
And then let's move over to this animate uh animation tab.

05:58.370 --> 06:00.570
And we're going to choose the attack animation.

06:00.770 --> 06:05.450
And let's say so we need to move this attack point somewhere around here.

06:05.450 --> 06:07.330
So it's just going to be middle center.

06:07.330 --> 06:11.290
So that's why from that position we just want to create the circle.

06:11.290 --> 06:18.250
So before you just uh before you change your attack point position, make sure you select the animation

06:18.250 --> 06:24.770
tab and then check with attack animation and perfectly place that, uh, that attack point.

06:24.770 --> 06:27.330
So we need to move this attack point over here.

06:27.330 --> 06:29.290
So it's gonna be center position.

06:29.290 --> 06:33.810
So I will select my attack point and let's move it somewhere around here.

06:34.330 --> 06:36.130
And this seems pretty much fine.

06:36.130 --> 06:39.090
So from this point we just want to create the circle.

06:39.090 --> 06:40.290
Now we assign it.

06:40.290 --> 06:42.650
So sorry we just created.

06:42.690 --> 06:47.370
Now we will choose our attack point underneath our animator GameObject in the hierarchy.

06:47.570 --> 06:51.120
Then sorry drag it over to this attack slot.

06:51.160 --> 06:53.560
In the bottom you can see attack Point.

06:53.560 --> 06:56.200
So let's drag it there and attack radius.

06:56.200 --> 06:59.360
By default we have chosen one, as you can notice.

06:59.360 --> 07:00.400
And what is player?

07:00.400 --> 07:06.560
We already assign it with player, so we don't have the third argument since we already have it.

07:06.600 --> 07:07.360
What is player?

07:07.360 --> 07:11.120
I have chosen player since I want to damage my player game object.

07:11.120 --> 07:12.560
So that's that's why.

07:12.840 --> 07:15.600
And let's select the parent game object basically enemy two.

07:15.640 --> 07:19.040
Let's go over to Inspector Overrides and then apply it all.

07:19.040 --> 07:24.840
So the changes you made, it's going to be saved into your enemy two game object prefab as well.

07:25.000 --> 07:28.680
And now we're going to open up our enemy two script by double clicking on it.

07:28.880 --> 07:31.160
And let's move over to Attack function.

07:31.160 --> 07:33.560
And let's remove this two forward slashes.

07:33.920 --> 07:41.400
So what we so as this function as a first argument, it's going to take the point from where we want

07:41.400 --> 07:42.320
to create the circle.

07:42.320 --> 07:45.240
So we're going to pass our attack point dot position.

07:45.240 --> 07:47.840
And the second thing it's going to take the radius.

07:47.900 --> 07:50.340
So we will pass our attack radius.

07:50.340 --> 07:55.580
And the third argument it's going to take the layer mask basically which game object we want to damage.

07:55.580 --> 07:57.660
So in my case it will be player.

07:57.660 --> 08:00.540
So layer mask I'm going to pass this word is player.

08:00.540 --> 08:03.820
And we do know that we have seen already what is player.

08:03.860 --> 08:05.180
We assign it player.

08:05.180 --> 08:08.060
And now we're going to close that up with semicolon.

08:08.060 --> 08:15.460
So this physics 2D function it's gonna create the circle from this attack point position with this radius.

08:15.460 --> 08:20.500
And it's gonna target or it's gonna damage our player game object, as you can see.

08:20.820 --> 08:25.900
So it's gonna create the circle from this attack point with this at that matchup attack radius.

08:26.100 --> 08:31.700
And if that circle really collide with this player game object, then this function right over here,

08:31.700 --> 08:37.260
this whole function, it's gonna give us a true value if the circle is really colliding with this player

08:37.260 --> 08:41.500
game object, and if it's not, then it's gonna give us a false value.

08:41.740 --> 08:44.740
So what we will do, we're gonna store it into a container.

08:44.780 --> 08:48.130
The result, and we will store it into a collider 2D.

08:48.170 --> 08:48.690
Why?

08:48.730 --> 08:52.490
Because this physics 2D overlap circle just gonna work as collision.

08:52.490 --> 08:55.930
So that's why we need to put it in a container or a variable.

08:55.930 --> 09:00.130
Or you can simply say in a parameter which will be collider 2D.

09:00.810 --> 09:05.050
So the type of the variable will be collider 2D or the parameter.

09:05.050 --> 09:10.330
And we can call this one to something like call info or collision information short for.

09:10.370 --> 09:12.330
And let's set equal to this.

09:12.330 --> 09:18.650
So this call info right over here it can be true or false depending upon if the circle is really colliding

09:18.650 --> 09:21.290
with this with this player game object or not.

09:21.290 --> 09:25.490
Let's suppose the circle we created is collide with this player game object.

09:25.490 --> 09:27.450
So this function is just gonna be true.

09:27.450 --> 09:29.810
So that's why this call info right over here.

09:29.810 --> 09:30.850
It's gonna be true.

09:30.890 --> 09:31.330
Why?

09:31.370 --> 09:32.970
Because we directly setting it.

09:32.970 --> 09:37.930
As you can see, Collider 2D call info equal to physics 2D dot overlap circle.

09:37.930 --> 09:39.410
So in the next time.

09:39.450 --> 09:41.970
So in the next what we will do we will check.

09:42.090 --> 09:46.520
So let's make this if condition and first packet and some curly brackets.

09:46.520 --> 09:48.360
And what we want to check over here.

09:48.360 --> 09:52.800
We basically want to check if call info is equals equals to true.

09:52.800 --> 09:54.400
Or we can just leave it like this.

09:54.440 --> 10:01.240
It's also basically means true means uh, our uh, circle is really colliding with this player game

10:01.280 --> 10:01.760
object.

10:01.760 --> 10:04.720
And we do know that we're checking if call info is true.

10:04.720 --> 10:09.200
Basically means that circle just colliding with that player game object.

10:09.200 --> 10:12.680
So right now what we need to do, we need to damage our player.

10:12.840 --> 10:15.200
So for now we're going to print out a message.

10:15.560 --> 10:22.080
But before we print out a message we just want to check uh, check if the circle is really collided

10:22.080 --> 10:25.680
with this player game object or something else or not.

10:25.680 --> 10:26.840
So we're going to check that.

10:26.840 --> 10:32.840
So that's why if call info is true basically means the circle is colliding with that player game object.

10:32.840 --> 10:38.760
So we also want to check if the game object the circle collider is the circle collided with.

10:38.800 --> 10:42.720
If that game object has a script called player script or not.

10:42.720 --> 10:47.070
And if we select our player game object in the hierarchy, then go over to Inspector.

10:47.070 --> 10:51.630
We can see a player script is attached to this player game object.

10:51.630 --> 10:57.350
So we just want to check if the circle collided with this player game object and the player script is

10:57.350 --> 11:01.830
attached to this player game object, then what we want to do, we want to damage.

11:01.830 --> 11:05.510
But before we before we damage, we're going to print out a message.

11:05.630 --> 11:11.630
And before we print out message, we also want to check if that game object has a script called player

11:11.630 --> 11:16.590
or component called player a is player script is attached or not.

11:16.830 --> 11:22.590
So that's why before we print out message, we just want to check if let's make first bracket, add

11:22.590 --> 11:25.750
some curly brackets and what we want to check over here.

11:25.750 --> 11:29.590
We basically want to check if the circle collided with the game object.

11:29.590 --> 11:31.670
So the circle definitely collided.

11:31.750 --> 11:34.110
Just going to collide with the player game object.

11:34.110 --> 11:40.150
So we just want to check if that player game object has a script called a, has a script called player

11:40.230 --> 11:40.910
or not.

11:41.070 --> 11:46.980
So what we will do, we basically do this thing we call info dot game object and call info dot game

11:47.020 --> 11:50.420
object basically means the game object the circle collided with.

11:50.460 --> 11:54.700
And now what we're going to do, we're going to use this dot get component.

11:54.700 --> 11:57.300
And the component we're looking for is player.

11:57.300 --> 12:00.140
So we will pass player uh player.

12:00.140 --> 12:03.980
Or you can simply say player skip and then make this first bracket.

12:04.220 --> 12:10.980
Uh, so we just take getting the player skip and we will check if it's not equal to null basically means

12:10.980 --> 12:19.340
that our player script sorry and not equal to null if it's the case uh, means we are ready to damage.

12:19.340 --> 12:22.780
So firstly what we're doing, we're checking if the call info is true.

12:22.820 --> 12:28.060
Basically means that we created the circle is really colliding with this player game object.

12:28.060 --> 12:30.220
And once it's collide what we doing.

12:30.260 --> 12:36.540
We firstly going over to that game object so called info dot game object basically means the game object

12:36.580 --> 12:38.220
the circle collided with.

12:38.220 --> 12:43.440
So in our case it's going to be player and we're just trying to get the player skip, as you can see.

12:43.440 --> 12:49.280
So we just are going over to this player script and we're checking if the player is script is not equal

12:49.280 --> 12:49.840
to null.

12:49.880 --> 12:53.680
Basically means this player is script attached to that player game object.

12:53.680 --> 13:00.160
And if we move over to unity, we can see indeed the player script attached to this player game object.

13:00.160 --> 13:01.920
So basically means it's true.

13:01.960 --> 13:05.040
Now what we can do, we can simply damage our player.

13:05.040 --> 13:08.120
But before we damage it, let's print out a message.

13:08.120 --> 13:14.280
Since we didn't, uh, given uh, given any uh, health amount to our player game object.

13:14.280 --> 13:19.320
So that's why for now, at this moment, we just only want to print out the message.

13:19.320 --> 13:22.640
So we're going to type this debug.log for printing out message.

13:22.800 --> 13:25.120
And we're going to say something like damage.

13:25.600 --> 13:33.600
Uh, or we can say uh call call info, dot GameObject, dot name and top of that I'm going to add a

13:33.600 --> 13:34.520
custom message.

13:34.520 --> 13:37.600
So use this plus icon then and this quotation.

13:37.600 --> 13:43.110
And you can just put a custom message that you want to see underneath your console tab.

13:43.150 --> 13:49.550
I'm going to say something like takes damage, takes damage, and let's close that up with semicolon.

13:49.550 --> 13:54.630
So call info dot GameObject basically means the GameObject the circle collided with.

13:54.630 --> 13:58.870
So in our case call info dot GameObject gonna be this player game object.

13:58.870 --> 14:03.550
Because the circle that we created, it's gonna collide with this player game object.

14:03.550 --> 14:05.670
So call info dot GameObject.

14:05.670 --> 14:07.910
There basically means this player game object.

14:07.910 --> 14:10.510
And then what we're doing accessing the name.

14:10.510 --> 14:12.430
And we can see the name is player.

14:12.430 --> 14:14.430
As you can notice in the Inspector.

14:14.430 --> 14:18.430
So this right over here we're calling for dot GameObject dot name.

14:18.470 --> 14:20.230
Basically just gonna be player.

14:20.230 --> 14:23.550
And top of that we just added a message text damage.

14:23.550 --> 14:27.510
So the so this message just gonna pop up says player takes damage.

14:27.510 --> 14:32.630
So this message just going to pop up as soon as the circle just gonna collide with that player game

14:32.630 --> 14:33.190
object.

14:33.350 --> 14:34.470
So now what we're gonna do.

14:34.470 --> 14:37.300
We're gonna press down Ctrl s to save our skin.

14:37.420 --> 14:39.300
And now let's move over to unity.

14:40.540 --> 14:43.420
And also we need to do one more scripting.

14:43.420 --> 14:49.660
Basically we need to add some line of code in order to see the circle that we created from that attack

14:49.660 --> 14:53.340
point from inside our enemy GameObject.

14:53.380 --> 14:54.300
Let me show you.

14:54.660 --> 14:57.980
Uh, so we do know that the circle will not be drawn.

14:57.980 --> 15:02.660
So we need to draw that with uh using on draw smooth selected function.

15:02.660 --> 15:07.140
And we're going to do the same thing as we have done inside our player shape.

15:07.180 --> 15:10.380
We will, uh, we will do in a same way.

15:10.540 --> 15:13.420
So just wait a moment, uh, to compile our script.

15:13.460 --> 15:14.460
Now it's done.

15:14.660 --> 15:20.260
And if we select our enemy to GameObject and press down F in order to focus on that.

15:20.260 --> 15:23.060
Sorry, I don't know.

15:23.100 --> 15:27.620
The enemy two script should be sorry, I really apologize.

15:27.620 --> 15:29.020
So this should be enemy two.

15:29.060 --> 15:29.620
Sorry.

15:29.660 --> 15:30.300
Enemy two.

15:30.340 --> 15:35.530
As you can notice that the circle will not able to see that we created.

15:35.530 --> 15:41.490
And in order to see that, we do know that we need to use a function called on draw gizmo selected.

15:41.490 --> 15:45.050
So let's open up our animator script by double clicking on it.

15:45.050 --> 15:49.890
And let's go over to our on draw mode selected function right over here.

15:49.890 --> 15:51.210
So we're gonna draw that.

15:51.210 --> 15:53.330
But before we draw we need to check.

15:53.610 --> 15:59.450
Basically we need to check that if we drag this attack point to attack point slot or not, if we if

15:59.450 --> 16:05.130
we haven't drag it, then we need to stop drawing drawing that circle because we don't have the attack

16:05.130 --> 16:05.410
point.

16:05.410 --> 16:06.250
So that's why.

16:06.290 --> 16:09.610
So before we draw the circle we just want to check.

16:09.610 --> 16:11.250
So we're going to use this if condition.

16:11.250 --> 16:13.930
Let's make first bracket and some curly brackets.

16:13.930 --> 16:15.890
And what we want to check over here.

16:15.890 --> 16:21.010
We basically want to check if our attack point if it's not equal to null.

16:21.210 --> 16:25.370
Not equal to null basically means that attack point we just drag it.

16:25.730 --> 16:31.130
So if you just drag it like this basically means attack point is not empty.

16:31.170 --> 16:33.720
It's we just assign it with attack point.

16:33.920 --> 16:38.920
And this attack point not equal to null basically means we just assign it our attack point.

16:39.040 --> 16:41.040
So now we have the attack point.

16:41.040 --> 16:44.440
And now we are ready to create the circle or to create.

16:44.480 --> 16:46.200
Sorry to draw the circle.

16:46.320 --> 16:49.000
So what we're going to do now we're going to draw the circle.

16:49.000 --> 16:53.160
And in order to draw that we're going to use this gizmos dot draw.

16:53.720 --> 16:59.440
Sorry draw where sphere function, this function and this function as a first argument.

16:59.440 --> 17:02.920
It's going to take the point from where we want to draw the circle.

17:02.920 --> 17:05.640
So we're going to pass our attack point dot position.

17:05.640 --> 17:07.840
And the second thing it's going to take the radius.

17:07.840 --> 17:10.360
So we will pass our attack radius.

17:10.360 --> 17:12.520
And let's close that up with semicolon.

17:12.520 --> 17:17.200
And I also want to assign the color that I would like to draw with.

17:17.200 --> 17:21.880
So to choose the color we before we draw we're going to use this gizmos dot color.

17:21.880 --> 17:25.520
And we can set the color that we would like to draw with.

17:25.520 --> 17:27.480
So I'm going to draw with yellow.

17:27.480 --> 17:32.870
So I'm going to pass color dot yellow sorry Color dot.

17:33.310 --> 17:34.510
Dot yellow.

17:34.750 --> 17:36.830
And then close that up with semicolon.

17:36.830 --> 17:40.110
So firstly we're checking if we assign it a tag point or not.

17:40.110 --> 17:43.310
Basically means a attack point fill is not empty.

17:43.350 --> 17:45.390
Basically we assign it attack point.

17:45.390 --> 17:47.870
So then we just choosing a color.

17:47.870 --> 17:51.910
And that color we just drawing our circle from this attack point.

17:51.910 --> 17:54.750
With this much of radius as you can notice.

17:54.750 --> 17:59.390
And now what we have to do, we need to press down Ctrl s in order to save our script.

17:59.390 --> 18:01.230
And now let's move over to unity.

18:01.390 --> 18:07.550
So as soon as our script just gonna compile, you will be able to notice from that attack point, that

18:07.550 --> 18:14.310
circle just gonna draw and the circle will be draw with this much of radius, which we by default we

18:14.310 --> 18:21.230
have given one, but we can just play around with the number and we just need to fit it perfectly with

18:21.270 --> 18:23.070
our attack animation.

18:23.070 --> 18:25.470
So we need to choose our attack animation.

18:25.710 --> 18:29.270
And now we can see the circle just drawn from this attack point.

18:29.670 --> 18:37.050
And we need to adjust this attack point in order to in order to cover up the attack range of this animation

18:37.050 --> 18:38.170
attack animation.

18:38.170 --> 18:41.330
So we will select our animator GameObject in the hierarchy.

18:41.490 --> 18:44.490
Then go over to animation tab and let's click over here.

18:44.490 --> 18:45.570
And we will check.

18:45.690 --> 18:48.450
We will choose our enemy to attack Animation Clip.

18:48.730 --> 18:51.210
And let's move it somewhere around here.

18:51.210 --> 18:54.050
So as you can see we need to fill this out.

18:54.050 --> 18:57.250
So that's why we're going to increase our attack radius.

18:57.250 --> 19:00.490
So we will select our animator GameObject in the hierarchy.

19:00.530 --> 19:02.970
Then go over to Inspector, then Animator Script.

19:02.970 --> 19:05.290
In the bottom we have the attack radius.

19:05.290 --> 19:06.930
So let's bump up the value.

19:06.930 --> 19:14.010
So we're going to do something around I guess two uh, to just uh, just a perfect number as you can

19:14.010 --> 19:14.330
see.

19:14.530 --> 19:16.770
So that is fine by now.

19:16.770 --> 19:19.970
So we're going to move over to overrides and then apply all.

19:19.970 --> 19:22.210
So the changes we made it's going to be safe.

19:22.250 --> 19:24.330
And now let's select our console tab.

19:24.330 --> 19:28.530
And let's click on this play button in the top in order to play our game.

19:28.560 --> 19:34.080
So as soon as the circle just gonna collide with this player game object, that message should be pop

19:34.120 --> 19:34.320
up.

19:34.360 --> 19:38.120
Says player takes damage, but it's not gonna pop up at all.

19:38.120 --> 19:38.520
Why?

19:38.680 --> 19:43.400
Because we just created that attack function and we never calling it anywhere.

19:43.400 --> 19:49.120
So that's why, even though we're gonna take damage from this enemy to game object, we can notice that

19:49.120 --> 19:53.000
the message is not getting pop up underneath our console tab.

19:53.040 --> 19:53.440
Why?

19:53.600 --> 19:56.840
Because we just made the attack function and we never calling it.

19:56.840 --> 19:58.360
So I'm gonna get out of play mode.

19:58.360 --> 20:05.440
And if we move over to our enemy two script and move over to our attack function over here, as you

20:05.440 --> 20:09.200
can see, we just created this function and we never calling it.

20:09.200 --> 20:15.200
So that's why it's not creating that circle around from around from that attack position.

20:15.200 --> 20:18.040
So what we need to do, we need to call this attack function.

20:18.040 --> 20:24.280
But when we need to call it once the the this enemy two game object just gonna play the attack animation

20:24.280 --> 20:24.880
clip.

20:24.880 --> 20:27.790
So we will select our enemy two game object.

20:27.830 --> 20:29.870
Let's move over to animation tab.

20:29.870 --> 20:32.230
And we're going to choose our attack animation.

20:32.230 --> 20:35.950
And let's move over some some frames something like this.

20:35.950 --> 20:37.990
So this is going to be perfect time.

20:37.990 --> 20:41.270
So we can call the function over here in this moment.

20:41.710 --> 20:44.150
So that moment the circle will be created.

20:44.150 --> 20:49.470
And if the circle collide with this player game object then the message just going to pop up says player

20:49.470 --> 20:50.270
takes damage.

20:50.270 --> 20:52.070
So we need to call the function.

20:52.070 --> 20:57.430
And in order to call the function we do know in animation tab in the left side basically over right

20:57.430 --> 21:01.750
over here in the right side assess it add event.

21:01.750 --> 21:03.230
So we need to click on it.

21:03.230 --> 21:04.510
Then select this event.

21:04.510 --> 21:06.070
Then go over to Inspector.

21:06.110 --> 21:07.910
As you can see function.

21:07.910 --> 21:10.030
And it says no function selected.

21:10.030 --> 21:13.790
So just click there and then go over to anime anime two script.

21:13.790 --> 21:16.670
Then methods you can simply say functions.

21:16.670 --> 21:19.230
And we created the attack function there.

21:19.230 --> 21:21.110
So we're going to choose that attack function.

21:21.110 --> 21:23.070
Now we're just calling the attack function.

21:23.070 --> 21:26.020
And we do know what attack function is really doing.

21:26.060 --> 21:31.660
It's basically creating the circle from this attack point with the attack radius amount.

21:31.740 --> 21:33.300
So now that's perfect.

21:33.300 --> 21:37.140
So what we're simply doing we're just going over to this Army two script.

21:37.140 --> 21:39.380
As you can notice right over here.

21:39.540 --> 21:45.020
And from here we're just calling this attack function and attack function basically doing these things,

21:45.020 --> 21:46.420
creating the circle.

21:46.420 --> 21:50.500
And before the circle collide with that enemy game object or not.

21:50.500 --> 21:55.860
Basically we're just checking if the player script is attached to that player game object or not.

21:55.860 --> 22:02.180
If it's not equal to null means the player script is sitting on our player game object, and if we select

22:02.180 --> 22:08.020
our player game object in the hierarchy, then go over to Inspector and we can notice that player script

22:08.020 --> 22:10.260
is sitting on this player game object.

22:10.300 --> 22:15.660
Then what we're doing, we just simply printing out this message says a player takes damage.

22:15.700 --> 22:19.220
As you can see, player takes damage message just gonna pop up.

22:19.620 --> 22:26.090
So not equal to null basically means the script is attached to that GameObject or the component attached

22:26.090 --> 22:27.450
to that GameObject.

22:27.570 --> 22:31.090
And now we're going to press Down control S one more time to save our script.

22:31.130 --> 22:34.010
If we have done anything any changes.

22:34.010 --> 22:36.130
And now we already chosen the function.

22:36.130 --> 22:37.970
So I'm going to select my console tab.

22:37.970 --> 22:42.210
And let's click on this play button in the top in order to play our game.

22:42.210 --> 22:44.170
And now let's take a look on this.

22:44.170 --> 22:50.010
So as soon as this animator GameObject just going to play the Attack animation clip, in that moment

22:50.010 --> 22:51.850
we're calling the attack function.

22:51.850 --> 22:54.930
And we do know what that attack function is really doing.

22:55.130 --> 23:02.290
It's basically just uh, we can see by now, and indeed we can see if we move over to our console tab,

23:02.290 --> 23:04.330
we can see a message just getting pop up.

23:04.330 --> 23:05.930
Says player takes damage.

23:06.090 --> 23:12.410
So instead of printing out message, we want to damage our basically this player game object.

23:12.410 --> 23:14.650
And we're going to take a look on this later.

23:14.650 --> 23:16.250
So we will leave as it is.

23:16.250 --> 23:18.370
Like this message should be pop up.

23:18.530 --> 23:22.170
And later on we're gonna we're gonna do the scripting thing.

23:22.390 --> 23:27.710
Firstly, we need to give some health amount to our player game object and we're gonna take a look on

23:27.710 --> 23:28.470
it later.

23:28.470 --> 23:30.070
So I'm going to get out of play mode.

23:30.070 --> 23:32.950
So I hope you get the idea that how you can do it.

23:33.790 --> 23:36.590
I hope you get the idea that how you can do it.

23:36.750 --> 23:43.830
And also we need to do one thing that we need to, uh, we need to basically we need to, uh, pop up

23:43.830 --> 23:49.470
some values, uh, or floating numbers, as we have done with enemy one game object.

23:49.470 --> 23:52.750
So this one will be a task for you to do that.

23:52.750 --> 23:53.830
So you can do it.

23:54.150 --> 23:58.910
You can just follow the same way as we have done inside this enemy one game object.

23:59.150 --> 24:05.350
Uh, so once this enemy two game object just gonna takes damage from our player game object, then this

24:05.390 --> 24:11.590
enemy two from this head, it should pop up that floating text number, something like 100, sometimes

24:11.590 --> 24:16.430
80, sometimes 99, sometimes 100, and sometimes one.

24:16.430 --> 24:21.500
And we do know we already have done it inside our enemy one game object.

24:21.500 --> 24:28.420
So this will be a little small task for you to do that inside this Army two game object inside your

24:28.460 --> 24:29.380
anime two script.

24:29.380 --> 24:31.780
So you can just follow the same thing.

24:32.180 --> 24:39.140
Uh, or you can just paste your, uh, you can just copy your code from your first anime, then you

24:39.140 --> 24:45.340
can just paste it over, uh, on on top of this anime two script or inside this anime.

24:45.340 --> 24:50.180
Two, uh, script, you can simply say, I hope you get the idea by now.

24:50.180 --> 24:54.460
And I'm gonna press down Ctrl s on my keyboard to save my project.

24:54.460 --> 24:59.900
And also make sure you select your anime two game object, then go over to Inspector Overrides and then

24:59.900 --> 25:00.700
apply all.

25:00.740 --> 25:07.060
If you just made this anime two game object a prefab, if you have done it, then you just need to go

25:07.060 --> 25:09.780
to Inspector Overrides and then apply all.

25:10.020 --> 25:12.740
So I hope you get the idea that how you can do it.

25:12.740 --> 25:15.420
And you enjoyed this, uh, lecture.

25:16.500 --> 25:19.620
So we're gonna take some look in the next lecture.
