Welcome to this new video.
Now we are going to create our fight.
We are bus.
Let's go to our scripts in our bus.
Let's create here a new folder.
Let's call these actions and he was create a new class.
You can call this action boss shift layer.
NOW LET'S OPEN THESE NEW CLASS AND HERE.
NOW WE NEED TO HEAR IT FROM A.
Action.
So let's say a A.I. action and implement our app method.
OK.
So these action for this boss will contain our three projectile behaviors and we're going to be using
the health of our player in order to choose which project of pattern use.
For example if the player has a max skill.
Let's use our circle pattern.
And if the player has resembles more than six and less than eight for example we want to use our flow
pattern.
So we're going to be doing that and to do that we need to get some reference.
Let's go to a state controller.
Delete all of this.
OK so here we need to get a reference to our player health to the health of the player.
So what we're to do is let's go here and here we can say property health we can call these player health
and here once we get these player we can say player health is equal to player get component health.
OK.
So we also need the reference of our three projectile behavior.
So let's go here and we can create a property of type boss super pattern.
Let's call it the same.
Let's duplicate this.
And this is going to be a boss random pattern.
Let's Is it the same.
And this is going to be equal to bus s flow pattern.
OK.
So now in a week we can say here Boss circle pattern is people to get components.
Boss circle pattern.
Let's not copy and paste this and let's add this one or this one here and here this one here and here.
OK.
So now we have the reference of three projectiles pattern so let's go to this project of patterns which
are here let's open these three OK so we're we're going to be controlling these enable shooting from
our new action in order to shoot in each pattern.
So only to do here is create a public method or we can do here is for example in circle pattern we can
say public void enable a projectile and this projectile this animal projectile method is going to return
that is shooting equal to true OK.
So now we just delete this one here or we can delete all of this is methods now in the action class
we're going to call this in order to enable the shooting of these circle pattern.
Let's do the same in our random atmosphere no let's go here and let's create a public void enable projectile.
And here we're going to say is shooting is equal to true.
Now when is and we need when we call this method we need to specify or to set this shot index that by
default is zero.
So let's put here shopping X is equal to zero.
And we also need to add days because for example when we call this the first time this is going to run
and we're going to shoot all or of our spit out pattern when that is completed we can't shoot again
until we say a shooting is true and shoot again.
But when we're going to shoot again we need to reset the shot index in order to show it to shoot all
our projected amount.
So that's why we are sitting here also shot in equal to zero and it's copy this go to random pattern
and pace it.
So now let's go to our start overwrite and delete it.
So here also in extra Let's delete this.
OK.
So now we can go.
We can delete these patterns and now we can work in your action boss player OK.
So why did you do here is create a private void.
We can call these shooters and pass our estate controller controller.
I also want to define here a public float should delay
by default these maybe three seconds.
We can also modify these in the inspector.
And here I want to call shoot and pass a controller.
OK so now we need to walk in the controller.
I want to create here also a private float next.
Short time goes.
OK.
So here we can say if time sorry if time dot time is greater than our next show time.
Now we can shoot and at the end let's update this next show time or next time is equal to time the time
plus this shortly.
This should delay.
Let's rename Mr. shot doing this shoot shot really confuses me.
So let's just use this shot delay.
OK.
So now here we can say if controller dot player health dot current health care current health is greater
or equal to seven.
We want to say controller that controller dot maybe still random boss s field pattern.
And here I want to save.
Fire project.
We need to do that properly.
So let's go to our three
here let's go through two or three and I want to call this one not my mistake.
We need to call the enable projectile.
That is my mistake.
I was confusing OK.
So here we need to call the enabled projectile.
OK so if our player has a health greater or equal to seven we're going to enable these boss a stroke
pattern in order to use this shot pattern here we need to say also if our controller George player health
not current health is greater or equal for example to 4 and this controller that player health Dot's
current health we can say here is less is less than 7 so if this is true let's say controller does on
what pattern we want to use now.
So if the player has a low health we don't want to kill it immediately so let's use an E C pattern.
Now we have a left our circle pattern on our random pattern and let's use just our random pattern.
So we left the circle pattern for the last check when our player is present or with heroin which was
two or three health.
So we can't kill the player so so easy OK.
So here we can say enabled project.
So now we can say if a controller DOD player held that during health we can say here is less done for
here we can say controller dot boss circle pattern not enable projectile.
So now that we have this we can here we are updating our next show time and when this is crypto object
it's enabled so we can call on enabled so we can reset the initial time we say initial time is equal
to zero OK.
So this is the basic behavior of these action boss.
Should player so net.
Now let's create our script object.
Let's go to actions.
So let's go to my actions and let's copy this one actual following the actual follow.
OK let's go here.
Let's copy here and he's going to be my boss
action and he let's say should later on this call.
This one here.
OK.
So now let's go back to unity and here.
Now let's go to a script of objects A.I. in a boss who know let's create the new action A.I. boss actions
sharply should play a certain.
So now let's go to our state test and we can call these now state and wonder let's make this wonder
to shoot.
It's designed to be confusing so as a stage boss wonder just like that.
So the action that we ought to have here is a wonder what is it action wonder and the translation is
going to be if a.
Oh but we need to create a new translation here.
And what transition we shoot at.
Let's not that anything by now let's just call our new actions so we can test this and then we're going
to see what we can create.
So now let's go to our boss and pass the action.
Let's go.
Let's enable these three because now we're going to enable their projectile shooting here by our action.
So let's go to our state controller and let's pass these boss one.
OK.
So this call just state was let's just test this and now let's press play
Let's send it are a scene view.
And right now our enemy is shooting every three seconds.
So the he is going to kill us for sure.
And this is too much.
Let's just take some damage in order to see these other patterns.
OK.
So now he has a random shooting.
So this is working.
And if we have a health of three for example let's just one more.
OK.
So now he's going to shoot and circle pattern.
So now these these working days doesn't receive damage for now.
But the new action we have created is working.
So now also we can die if we collide with this.
And now we're dead.
If we press B now we have revived.
OK.
So now the basic A.I. for our boss is work.
If you die.
OK.
So now the basic A.I. for our boss is working.
OK so now what we need to do is add some transitions.
OK so this is there is stop playing.
Let's go to our boss.
Let's create some folders.
He's going to be.
Actions.
Decisions
on estates
Reg is going to be creating one estate for our boss.
But let's just make these folders so we have everything organized as bread.
This one here in our state here OK so I want to make these am I want to make these boss wonder.
So let's create our new state.
Let's go by the state estate boss wonder.
And for each enemy or each A.I. inner gain we need to create a specific estate because we can't use
for example one state wonder in both this enemy and his boss we're going to have some problem because
we're using script level objects and the good thing about script of objects that we can create a bunch
of assets so we don't have problems with it's creating for example one wonderful one wonder action from
for one enemy and another for the bus.
So we're going to do that is go to actions and just create a new wonder that is going to be only four
hour bus so we can call this action wonder but let's call this action boss wonder.
Now let's go to states a state boss wonder at one action which is going to be our action both wonder
on this great transition this great new decision which is going to be I decisions.
Detective it just we can add a range to this boss.
It's called the debt decision boss.
The text so the player enters the boss range.
This one is going to start shooting so the laser in order to detect is going to be the player.
So let's go to our state boss wonder and if the player enters these boss range.
So the decision was attacked.
What we want to go is to estate boss attack.
Let's call this one are should.
So if the player enters these enemy range this subject is boss range.
Let's go to state boss should if not let's remain here.
Now let's.
What's the problem.
So now here we can say when we are in these new ad and need in this new state that we're going to be
shooting.
Let's also add a transition that we're going to shoot only if the player is in our range.
So let's ask you a decision both attacked.
So if the place is still in this range we go here.
Drew is going to be remain in the state.
So if this player is is still in this range let's continue shooting the player if not let's go back
to State.
Boss wonder OK so now I note I want to have this province.
What is this some big thing that this matter.
So let's just play now and let's see if this is working rhetoric or a scene and we have a problem.
Okay I know why we don't have a character controller we don't have a character movement we don't have
also a rigid body here rigid body to the box collider too deep.
Now this is going to be using a key pneumatic let's go to Moscow right.
OK so let's see if this is OK here gizmos because let's reset this one here OK.
So the e the sprite of the image of the sprite of the boss is too big.
So let's resize it ourself let's put it like here maybe here not just here here OK so now we have the
box collider for our bus.
So now let's delete all of this nice press play and let's see if we have any new problem or this is
working.
Is this working.
Yeah.
This is working but so we can safely delete all of this while we have a problem which probably means
there's one debatable character animator of character has not been assigned.
So we need to create an animator.
Let's open this character movement.
I want to say here if and countercultural animator movement
so we are setting a movement a movement value into this boss but our boss doesn't have an animator so
we can say here.
If the character that animator is different from all we're going to call this and the same here it's
just go here.
If this is equal to true so we have a harder animation.
Let's use it.
So it's always a great idea to all to always check things in order to use it.
So now let's go back to our coat Let's delete this and let's see if we have any new error.
And we have it seems just let's press play and we have new problem and we don't have it.
Okay so now this is working.
So our enemy is our boss is wondering.
But let's make these radios these range bigger.
So we have a new problem.
Let's open this draw line draw a line from the transfer position to the preposition.
So I don't want to draw that line just this delete all of this and let's go to.
Okay.
So we have a new problem.
OK let's just for now disable this enemy because because we are doing we are in casting this line is
the bottom line from this is State Controller to the player.
I think we have this problem between selecting which of this state controller is going to he's going
to point towards our player.
So for not for that let's just disable these weapon enemy and now we can safely delete all of this.
So we have still these let's just delete this on drugs most We don't need to have that.
Come on D down ever here.
Okay.
Go away OK.
So now let's press play but before we do that let's increase these boss range.
Maybe seven.
Now let's press play
okay.
So now we have these working we don't have any arrows here and we are going we are doing these Estuardo
patter oh the just the end the boss go through went through the wall where is it.
OK I know why the lad.
Why is this happening.
Let's go to our boss and we selected and M.I.T. that was something I believe I could I could do is use
dynamic and rapid scale zero.
OK.
So yeah that was my mistake because we have created our logic using dynamic and I just selected schematic.
So that is why these boss kids go through our wall OK.
So let's press play now.
This should be working as expected.
So now he's colliding.
OK.
So he's shooting but we can't kill it now.
And he is rotating.
Let's go to boss.
Let's go to constraints constraints.
These fresh rotation in.
OK so I believe that is the last thing we needed to do.
So I I believe now this is OK.
So it is moving.
Come here.
Shit.
Because we are in his range.
He can shoot and if we just exit these boss ranch he can't shoot.
So let's go here and yet because we are not in his range.
He can't shoot.
But once we enter here he's going to shoot.
Yeah.
So now these action for our boss is working.
I'm sorry for all that mistakes but we had we had to do that.
That's part of the game development.
OK.
So where is he.
OK.
So we get done.
We are going to create now our UI in order to see the health of our boss.
So I'll see you in the next video.