WEBVTT

00:00.040 --> 00:03.960
Now we need to make transition between those animation clips.

00:04.120 --> 00:06.800
So let's select this animation in the hierarchy.

00:06.840 --> 00:11.240
Let's go over to animator tab so we can see all of these animation clip.

00:11.560 --> 00:17.520
Uh so if we just go ahead and then click on this play button in the top you will see this anime one

00:17.560 --> 00:21.200
underscore idle just gonna play right after the game start.

00:21.200 --> 00:21.560
Why?

00:21.720 --> 00:25.000
Because this one the default animation clip.

00:25.000 --> 00:26.640
So that is the reason.

00:26.640 --> 00:32.000
And we also need to make a transition between this arrow fire heart and death.

00:32.320 --> 00:34.160
So just wait a little moment.

00:34.400 --> 00:40.760
Uh, so as you can see, as soon as our game started this anime one, just playing the idle animation

00:40.760 --> 00:47.120
clip over again and again, and we can see, uh, we can notice in our animator tab.

00:47.120 --> 00:51.680
So let's get out of play mode and let's make transition between this animation clip.

00:51.680 --> 00:55.400
So let's right click on this idle make transition to Arrow Fire.

00:55.560 --> 00:57.120
And let's select this transition.

00:57.120 --> 00:58.400
Go over to Inspector.

00:58.440 --> 00:59.360
We're gonna untick.

00:59.360 --> 01:04.510
This has exit time because as soon as our player just gets in attack range.

01:04.510 --> 01:07.950
This enemy need to fire the arrow right away.

01:08.150 --> 01:14.670
Also, we will choose transition duration to zero and if we scroll down, we need to choose a condition

01:14.670 --> 01:18.390
in which condition we want to play that animation clip.

01:18.390 --> 01:21.030
So for that we will choose a bool parameter.

01:21.030 --> 01:22.910
So let's head over to animator tab.

01:22.910 --> 01:25.870
So let's click select this parameters.

01:25.870 --> 01:27.630
Then click on this plus icon.

01:27.630 --> 01:29.070
And let's choose a bool.

01:29.070 --> 01:33.230
And we can call this one range in range.

01:33.230 --> 01:37.390
So let's call it instead in range in range.

01:37.390 --> 01:39.790
So we will go over to Inspector.

01:39.830 --> 01:42.630
Let's click on this plus icon in this condition.

01:42.630 --> 01:45.590
And we will choose if in range is true.

01:45.630 --> 01:52.670
If that is the case then it's gonna play the arrow enemy arrow enemy one arrow fire animation clip right

01:52.670 --> 01:55.270
away of this enemy one game object.

01:55.390 --> 02:01.790
And also we need to make transition back to our idle or we will stack forever into this enemy.

02:01.830 --> 02:05.060
One arrow fire animation clip.

02:05.060 --> 02:09.740
So let's right click on it and let's make transition back to our anime -- idol.

02:09.980 --> 02:11.500
And let's select this transition.

02:11.500 --> 02:15.460
Let's go over to Inspector and we're gonna untick this axis time.

02:16.060 --> 02:17.500
Or we can just leave it.

02:17.580 --> 02:21.660
Uh, or we can just simply uncheck that has exit time.

02:21.660 --> 02:28.500
So as soon as this player in not attack range of this anime game object enemy one game object, then

02:28.500 --> 02:32.420
this enemy one game object need to play this idle animation clip.

02:32.420 --> 02:35.260
So that's why we just uncheck the has exit time.

02:35.260 --> 02:37.100
We're gonna do it immediately.

02:37.300 --> 02:38.820
And transition duration.

02:38.820 --> 02:40.220
Let's set it to zero.

02:40.220 --> 02:44.300
And if we scroll down we need to choose a condition in which condition.

02:44.300 --> 02:48.540
We want to play this idle animation clip of this anime one.

02:48.540 --> 02:50.380
So let's click on this plus icon.

02:50.380 --> 02:53.540
And now we're gonna choose if in range is false.

02:53.540 --> 02:55.300
So we will uh check.

02:55.340 --> 02:56.260
We will set this.

02:56.300 --> 03:00.740
If in range is false then it's gonna play the idle animation clip.

03:00.740 --> 03:07.210
So if we just go ahead and then click on this play button in order to start our game and then manually

03:07.210 --> 03:12.650
set this parameter to check or uncheck, basically setting it to True or False.

03:12.650 --> 03:15.010
You will see the animation just gonna play.

03:15.330 --> 03:23.490
So if I go if I go my animator tab and set this in range parameter manually to true or check.

03:23.530 --> 03:29.530
As you can see it's playing the arrow animation clip over again and again.

03:29.530 --> 03:36.010
And if I uncheck or set this in range parameter to false manually, we can see that it's now playing

03:36.010 --> 03:39.050
the idle animation clip of this anime one.

03:39.370 --> 03:42.810
So we need to set this in range parameter through our code.

03:42.810 --> 03:47.890
And we need to check the distance between our player or with this anime.

03:48.010 --> 03:54.730
So if the player just came in attack range, then this enemy need to play this arrow fire animation

03:54.730 --> 03:55.170
clip.

03:55.170 --> 03:58.490
So basically we need to set this in range parameter to true.

03:58.490 --> 04:03.810
And we don't know once we're gonna set it it's gonna play that animation clip as you can see.

04:03.850 --> 04:09.200
And if we set it to false we can see it's now playing the An idle animation clip.

04:09.200 --> 04:10.680
So let's get out of play mode.

04:10.680 --> 04:14.640
And let's also make transition to this heart and death.

04:14.880 --> 04:16.720
And we're going to do it any state.

04:16.720 --> 04:20.040
Let's suppose this enemy game object attack on this enemy.

04:20.120 --> 04:20.640
Sorry.

04:20.680 --> 04:24.760
Let's let's suppose this player game object attack on this enemy.

04:24.760 --> 04:25.920
One game object.

04:25.920 --> 04:33.560
Then this enemy need to play a heart animation clip instead of playing the idle or arrow fire, it should

04:33.560 --> 04:37.560
play the heart since we damage this enemy one game object.

04:37.560 --> 04:41.400
So that's why we're going to make the transition from any state to heart.

04:41.400 --> 04:43.320
So let's right click on any state.

04:43.320 --> 04:45.480
Let's make transition to our heart.

04:45.480 --> 04:47.080
And let's select this transition.

04:47.080 --> 04:48.640
Let's go over to Inspector.

04:48.640 --> 04:49.680
And we're going to uncheck.

04:49.680 --> 04:53.160
This has exit time and transition duration to zero.

04:53.160 --> 04:56.440
And if we scroll down we need to choose a condition.

04:56.440 --> 04:59.640
So what we will do for this we're going to choose a trigger.

04:59.640 --> 05:01.360
So let's head over to animator.

05:01.360 --> 05:02.960
Let's click on this plus icon.

05:02.960 --> 05:04.720
And let's choose a trigger.

05:04.720 --> 05:09.120
And we can call this trigger to heart or heart something like that.

05:09.120 --> 05:12.270
Or you can call this one damage as well.

05:12.670 --> 05:20.950
So we also need to make transition to idle or arrow fire arrow fire or we will stack forever into this

05:20.990 --> 05:23.910
enemy one underscore heart animation clip.

05:23.910 --> 05:25.310
So let's right click on it.

05:25.310 --> 05:29.150
And let's make transition to idle as well as let's right click on it.

05:29.190 --> 05:31.230
Make transition to arrow fire.

05:31.470 --> 05:35.190
And let's select the transition from this heart to our idle.

05:35.190 --> 05:37.070
So we will go over to Inspector.

05:37.070 --> 05:43.310
And we're gonna leave the has exit time because we want to play the idle sorry heart animation clip.

05:43.310 --> 05:44.270
So that's why.

05:44.590 --> 05:47.350
And we will choose exit time to one.

05:47.350 --> 05:54.830
So one basically means we do know that it's gonna play the 100% animation clip of of this enemy one

05:54.870 --> 05:55.270
heart.

05:55.270 --> 06:01.030
And after that it's gonna move over to Idle Animation clip, and we will set the transition duration

06:01.030 --> 06:01.750
to zero.

06:01.750 --> 06:07.150
And if we scroll down, uh, we, uh, if you want to choose the condition, you can do it.

06:07.150 --> 06:12.900
And if you don't want to choose any condition, then it's it's automatically just gonna move over to

06:12.940 --> 06:16.700
this anime one underscore idle animation clip.

06:16.820 --> 06:21.780
Once the anime one underscore animation clip played 100%.

06:21.780 --> 06:23.260
So make sure you leave.

06:23.260 --> 06:29.500
This has exit time to tick, and we're gonna do the same thing from this heart to our arrow fire.

06:29.740 --> 06:35.140
So we will leave the has exit time and exit time to one, transition duration to zero.

06:35.420 --> 06:42.540
And if we don't choose any condition, then it's gonna play that animation for this hard to our arrow

06:42.540 --> 06:42.820
fire.

06:42.820 --> 06:48.180
I'm gonna, I'm gonna say something like, so let's click on this plus icon and we're gonna choose this.

06:48.220 --> 06:49.860
If in range is true.

06:49.860 --> 06:56.220
And we do know that if in range is true basically means this player just come comes in attack range

06:56.220 --> 07:00.340
of this enemy one, then this enemy one need to play the arrow fire.

07:00.340 --> 07:02.820
So that's why we have chosen that condition.

07:02.820 --> 07:09.740
And for this heart, from this heart to our idle, we can choose this in range to false, something

07:09.740 --> 07:10.340
like this.

07:10.460 --> 07:17.380
Or if you just remove that condition by clicking on this icon and you don't choose any condition.

07:17.380 --> 07:22.820
So in that moment, after playing the heart animation clip, it's just gonna move over to this enemy

07:22.820 --> 07:29.420
one underscore idle animation clip automatically, so you don't need to choose the condition, but if

07:29.420 --> 07:31.340
you do one, then you can choose that.

07:31.380 --> 07:35.380
It's basically totally up to you, but I'm not gonna do it.

07:35.380 --> 07:41.620
And we can do the same thing in this, uh, from this heart to our arrow fire, we can remove the condition.

07:41.620 --> 07:44.580
Uh, but for this arrow fire, I'm gonna leave that.

07:44.580 --> 07:51.340
So now if we go ahead and then manually trigger this heart parameter, you will see heart animation.

07:51.340 --> 07:52.380
Just gonna play.

07:52.380 --> 07:59.300
And after playing 100%, it's just gonna move over to arrow fire or idle, depending upon where player

07:59.300 --> 07:59.580
is.

07:59.580 --> 08:02.100
But we gonna talk about it later.

08:02.100 --> 08:09.340
So if I move over to animator tab and then trigger this heart parameter manually, uh, manually, we

08:09.340 --> 08:12.580
cannot able to see basically what we have to do.

08:12.620 --> 08:14.020
Let's get out of play mode.

08:14.260 --> 08:17.170
Uh, basically, we forgot to loop the animation.

08:17.170 --> 08:24.170
So if I head over to my project app assets, then animations folder and my animations folder anime one

08:24.170 --> 08:25.330
animations folder.

08:25.330 --> 08:28.970
And if we choose the hard one, we're going to check this loop time.

08:29.170 --> 08:35.850
And now if we go ahead and then click on this play button and then try to trigger that hard parameter

08:36.250 --> 08:38.570
manually, we should able to see.

08:38.850 --> 08:40.890
So just wait a little moment.

08:41.090 --> 08:47.690
So now if I choose my animator tab uh but but before you choose make sure you select your anime one

08:47.690 --> 08:50.490
in the hierarchy, then move over to animator tab.

08:50.650 --> 08:57.490
And if we trigger this hard parameter manually, we not able to see because we forgot to choose that

08:57.490 --> 08:57.930
condition.

08:57.930 --> 09:03.370
Basically, what we have to do if we get out of play mode and then choose this arrow, then go over

09:03.370 --> 09:04.090
to Inspector.

09:04.090 --> 09:04.970
Scroll down.

09:04.970 --> 09:10.370
As you can see, we haven't choose this hard condition, so we need to choose that.

09:10.650 --> 09:15.130
So that's why we're not playing this hard animation clip of this anime one.

09:15.130 --> 09:18.800
So we need to choose this hard heart trigger parameter condition.

09:18.800 --> 09:23.040
So whenever we're going to trigger it it's going to play this heart animation clip.

09:23.240 --> 09:28.000
So if we go over to Inspector and then scroll down we can see list is empty.

09:28.360 --> 09:30.920
Basically we haven't used any condition.

09:30.920 --> 09:32.840
So let's click on this plus icon.

09:32.840 --> 09:34.280
So we're going to choose our trigger.

09:34.280 --> 09:35.480
So let's click here.

09:35.480 --> 09:37.040
And we're going to choose this heart.

09:37.120 --> 09:42.840
So basically means that if we trigger this heart parameter it's going to play the heart animation clip

09:42.840 --> 09:45.400
of this anime one right away.

09:45.400 --> 09:51.880
And after playing that it's going to move over to idle or arrow fire depending upon where player is.

09:51.880 --> 09:57.480
But we have to do it inside through our code and we're going to talk about it later.

09:57.760 --> 10:04.640
And also I want to uncheck the loop time of that heart animation clip of this anime one, because we

10:04.640 --> 10:07.080
have done the mistake here, not there.

10:07.080 --> 10:10.640
So let's head over to our project app one more time.

10:10.680 --> 10:11.200
Assets.

10:11.240 --> 10:15.720
Animation, anime, animation, anime one underscore animation.

10:15.720 --> 10:20.110
And let's choose the heart one and uncheck the loop time in the inspector.

10:20.110 --> 10:26.030
And now if we select our enemy one inch the hierarchy, move over to animator tab and then click on

10:26.030 --> 10:27.110
this plus icon.

10:27.110 --> 10:34.310
Now we should able to see because we have chosen this hard trigger condition by now means that if we

10:34.310 --> 10:41.590
trigger this parameter manually, it should play the heart animation clip of this enemy one right away.

10:41.590 --> 10:47.670
So if I try to trigger this heart parameter manually, as you can see, as soon as we triggering, it's

10:47.670 --> 10:49.390
playing the heart animation clip.

10:49.390 --> 10:54.990
And once our heart animation clip played completely, it just move over to this idle.

10:55.110 --> 11:01.110
And if the player in attack range then it's it's gonna play this animation clip and we have to do with

11:01.110 --> 11:02.030
our code.

11:02.030 --> 11:06.750
So I hope you get the idea that how you can just do it, we're doing it manually.

11:06.750 --> 11:11.070
Instead of doing this manually, we need to do through our code.

11:11.190 --> 11:16.830
And we also make also need to make transition to this enemy one underscore death.

11:16.950 --> 11:18.550
So let's get out of play mode.

11:18.550 --> 11:22.380
So we also need to make transition to animated anime.

11:22.420 --> 11:26.660
One underscore that, and we need to make this transition from any state.

11:26.660 --> 11:33.780
Let's suppose this anime loses all of his health, then it's need to play the anime one death animation

11:33.780 --> 11:38.540
clip right away, no matter what this player is really doing.

11:38.540 --> 11:45.660
Like, uh, playing the animation clip or heart, it doesn't need to be because once this anime one

11:45.700 --> 11:52.580
loses all of his health, then this anime one need to play the death animation clip right away instead

11:52.580 --> 11:55.020
of playing any other animation clip.

11:55.020 --> 11:58.220
So that's why we're going to make transition from this state.

11:58.460 --> 12:02.580
Uh, and we need to we're going to choose a condition for this as well.

12:02.580 --> 12:07.980
So let's right click on this any state and let's make transition to anime one underscore death.

12:07.980 --> 12:10.700
And now let's choose this transition.

12:10.740 --> 12:12.060
Go over to Inspector.

12:12.060 --> 12:14.180
And we're going to leave this as exit time.

12:14.380 --> 12:19.740
And this exit time we're going to choose one and transition duration to zero.

12:19.780 --> 12:26.370
Why we have chosen one because we want to play the death animation clip of this enemy 100%.

12:26.370 --> 12:28.610
So that's why we just leave it to one.

12:28.850 --> 12:32.170
And if we scroll down, we need to choose a condition.

12:32.170 --> 12:35.970
So we're gonna choose a trigger condition for this enemy one.

12:35.970 --> 12:37.650
So let's go over to animator.

12:37.650 --> 12:39.290
Let's click on this plus icon.

12:39.290 --> 12:40.690
Let's choose a trigger.

12:40.850 --> 12:43.570
And we're going to call this trigger to something like that.

12:43.930 --> 12:47.970
And we're gonna choose this condition or this trigger condition.

12:47.970 --> 12:50.770
So let's click on this plus icon in the inspector.

12:50.770 --> 12:52.930
And we're gonna choose this trigger condition.

12:52.930 --> 12:59.770
And we're not gonna make a transition from this state to heart idle or arrow fire, since our enemy

13:00.170 --> 13:01.570
loses all of his health.

13:01.570 --> 13:08.410
So that's why we're not gonna make transition, uh, from this state to heart or idle or arrow fire.

13:08.410 --> 13:09.610
So we're gonna leave that.

13:09.610 --> 13:15.930
So now, if we go ahead and then click on this play button and manually try to trigger this death parameter,

13:15.930 --> 13:18.850
you will see that death animation just gonna play.

13:19.010 --> 13:25.840
And after playing it's not gonna play any other animation clip since we didn't make any transition from

13:25.840 --> 13:26.600
this state.

13:26.600 --> 13:33.200
So if I try to trigger this state parameter, as you can see, it's played that and it's not, move

13:33.200 --> 13:41.320
it over to any other animation clip because we don't want be cause this enemy game object just loses

13:41.320 --> 13:42.280
all of his health.

13:42.320 --> 13:45.600
Then it's a need to stop playing hard or idle.

13:45.640 --> 13:52.400
Since this is since our enemy game object loses all of his health, so we're doing it manually.

13:52.400 --> 13:58.480
So instead of doing this manually, we need to do with our scripting with scripting.

13:59.160 --> 14:00.920
So I'm gonna get out of play mode.

14:00.920 --> 14:03.800
So I hope you get the idea that how you can do it.

14:04.080 --> 14:10.720
And we need to create a script in order to trigger or set this parameter through our code, depending

14:10.760 --> 14:12.360
upon where player is.

14:12.360 --> 14:18.920
If the player gets in attack range, then we basically need to trigger this parameter or basically taking

14:18.920 --> 14:21.400
damages from this player game object.

14:21.400 --> 14:27.000
So I hope you get the idea that how you can make transition between these animation clips.
