What's up guys.
I'm right here and I'm back with another with you.
So I did my homework and I was trying to say in previous video initialization because I was explaining
what awake I am what is the difference between a awake and a start.
And I said somewhere in half of the video halfway through seven minutes I think that they're both used
for initialization.
So I did my homework.
Hopefully you understand what I want to say and without further ado let's start scripting our hook because
I'm pretty excited to do that.
Oh.
I mean I pretty much like Yoda.
So first we are gonna have our function for it and function is going to be called Public void Start
fishing like this.
And before we actually do anything I'm going to put the can move to be false because probably somewhere
around here we will have it to be true so we can know when can we actually fish.
So first we're going to have our linked to have our links.
We will have to use our idol manager which will store all of our.
It will store all of our hundreds of all of our net variables but integers.
I mean that is a variable.
It will hold out all of our data for length for strength for offline earnings and so on.
So for now I'm just going for testing purposes.
I'm going to put negative like 50 but here I'm going to comment.
I don't it'll manager like this.
And Jeff.
So we know man and man.
Just let me say man in general like this.
Yeah I did correctly.
So we actually keep men and gentlemen.
So actually we know something in that is not right but something is missing.
And I'm gonna do the same for this strength.
So let's say it's not there but the lowest ranked said Drang like this equals to let's say three because
that will be default.
And I'm going to say Idol manager like this now as for the fish count it will be zero because we will
reset it.
Then we will have our float time which is going to be equal to negative length.
So now length multiplied by zero point one like this.
Zero point one.
Afloat.
And one thing I want to mention you will see that length is always going to be negative.
Why.
Well because when you want to hook you will not go up but down.
And for our hook to go down it has to go at the negative side.
So keep that in mind.
So if I want to hook vicious our idea there hook to go down not up for it but downwards.
And for that you will have ah ah ah ah length.
Be negative.
So you do not get confused.
You know what I mean.
So right now it comes time to use these tweener or camera tweet.
So let's start first we're going to say camera tweet.
I'm going to separate camera camera.
Tweet equals to main camera dad transform that do move.
Why.
So this is one of the script that tweets.
So if you actually read.
Come on then what if you actually read what it says it tweens attention y position to a given value.
Also stores that transform as the tweets target so it can be used for filtering operations.
Why do we have here we have our tweets transform y position to a given value.
So we want to try to animate or tween our hook going downwards.
So to do that we're going to say land blank.
I mean we are going that way.
And the value is going to be length the duration for it will be R one plus.
No not like that Plus where is our mark plus.
Come on.
Okay.
I'm going to leave this out because I have four.
I have my print screen on plus.
So plus time multiply by zero point twenty five.
As for the snapping is they can be false.
So it's going to be smooth.
No stabbing involved then dot on update on update.
So set on update callback for the team clearing I mean any previous on update callback was said call
it each time.
So this update is same as updates here inside of our unity.
So this will be on as the main camera is moving.
So until we reach the length I mean the end of it this update will go on.
So an update we can have our almost deleted hopefully not hopefully but thankfully we have we are blessed
with undo.
So here we're going to have our delegates and we are using our delegates.
If you do nothing what is your basic delegate.
I can talk about it like in a separate video like 10 minutes long.
But in this case delegates can be used for a value that can be changed out to the game more like you
can use delegate for two different functions like Unity showed an example like you have Brent now that
Prince down 50 and print double mom would do which doubles that up and then makes like two hundred and
we delegate that is possible.
You can use the same delegate which let's say 50.
But when you use it within the different functions you will have like different outcomes and you can
always have multitask in it so you can include more functions in it.
And by adding plus or minus you can always delete it.
Hopefully understand what I met a man.
I mean if you did not just google up delegates and you will have unity on a video like it's four to
five inches long where they explain what it is or you can even go back to see sharp and see what delegate
is right there then add is curly brackets like this and then inside we're gonna check if our main camera
so main camera that from that position.
The why is less or equal to negative eleven.
If that is the case we are gonna say transform that said parent and we are going to set our parent for
the hook to be main camera and transform like this.
And of course add these has not so much.
I think it's called semicolon.
Can remember for updates.
Next off Boudin I have a nine.
I know you do not add here at here actually dot on comp. So this was on update and I know this is incomplete.
So the gate like Gate C we're using here even delegate Oh my.
So it's complete then not curly bracket but actually parentheses.
Then delegate delegates.
And now our delegate is going to be checked if our delegates command what just happened here.
I'll get to I have mouse I mean on the laptop and I mouse and I accidentally I guess click somewhere
without me knowing as I will say uncompleted began to say that I collect collider dot enabled equals
to true.
So it is only enabled when you are when we are finished that we're going to say camera two we equals
two main camera main gamma dot transform dot do you Y.
And we are going back to zero so we're going back up.
So this is to delay.
Which let's say for now minus 50 and now our end value is zero.
We're going back to the beginning in our time multiplied by five.
So right now we are going faster and our scrapping will be false like this false.
Now while death do more Y is going on we are going to say dot on a date.
So is another update.
Delegates and you will have another delegate which will check in are what's called.
If our main camera does transform that position dot why is greater or equal to negative twenty five.
So when we reach some point we are gonna stop feet shake we're going to have actually that function
but not now but later.
So let me just added so we do not have like no errors.
Void stop stop.
Shaped like this as you can see so right now I am going to briefly explain what is going on here.
So right now we have our camera.
We are trying our camera in our camera tweet equals two main camera that transform that.
Do you know why.
And we are moving our camera to lead on the move.
Why to the length and keep in mind that our main camera is or it is going to be are inside of the home.
So we are moving it to the length.
So depending on how might that be score and so on.
How are you having.
We're going to do that in this time.
So one plus time multiply by zero point twenty five.
So this testing you can change it if you do not like it and snap it will be false while that function
is going.
We are actually setting up our camera to be.
I mean I have to be a parent of our camera.
So it follows it around.
Now when that is complete.
So when we finish when we go to the length and finish that we are going to enable our collider so we
can catch fishes and we are going back with our camera upwards so we can actually stop fishing.
So we are going to stop fishing.
We may get to minus 20 minus 25.
Or we catch enough fishes as you can see right here.
So yeah that will be it.
Now below it we're going to have another function which is going to be off for our game screens screen
games related like this.
So we know something is missing.
Then when that is done.
So what is this.
This is for this I think.
I'm not sure.
Let me get.
So this has to be when it's completed.
Not like this I can't I'm not 100 percent sure but I'm going to go with low so let me check.
Yeah.
So yeah I'm right.
So scream get here then collider that enable will be false when we start.
And I can more can move will be true.
And we are gonna clear our hook.
So this simple use that's for liberty.
This is when we are done through salvation we are setting this up.
Going through this code and when everything is done we are setting up this again so I think we can test
it right now.
It probably should work.
Let me see if I click lay I should go down and nothing is happening.
Actually I go that right now even my.
OK I know why.
My bad.
First we have to add this.
So actually this is a to be a button.
So I was going to create a new AI.
And where is it button which is going to be called Start star start fishing like this.
And inside that cap I click which is going to be a hook and function will be starts pink sheet.
So right now I actually am not going to display anything just briefly because I will do that in another
video when we do you we do.
I click all and then put it like this.
Delete that text and just put our start.
To be to be not visible.
So it's like this it's there but it's not visible right now.
Oh I just I just came up with a way that I could do it without it snapped.
Now my click is you can see our fish goes down.
And now right now we will go back and when we hit minus 25 we are going to stop fishing or we should
have stopped fishing but we don't have our stop fishing script.
So we are actually just going to be loop through until we hit the point which is right here.
And then again we will be able to fish and so on and so forth.
So right now it is working.
So we can't actually cook.
I mean start fishing but we cannot stop.
So let's do our stop real fast.
So for the starboard and say can move equals falls like this camera Dwayne the keel equals falls then
we're going to say camera.
We equals to you main camera.
Dodd transformed Dodd doing why why we're moving away to the zero duration to only two and then false
like this false then dot come on Dodd on update an update and I we have our own delegate delegate.
The league gave this.
We are checking here.
If our main camera Dodd transform that position DIY is greater or equal to minus eleven.
If that is true we're going to say transform Dodd said parent is no such parent is enough.
We're going back to normal and we're saying transition that position equals new vector.
Do you actually like three and that a chance from that position that X and then negative six.
So this is where our hope will end up.
So back at beginning now and complete.
So there was this was an update on complete delegate Ben.
Ah well ah are what's called ah hook is done.
When start stop saying we're going to say chance that position equals to vector to that down multiply
by six so meaning there you're just plain pointing it to the negative six.
Then we're going to say collider dot an angel equals to true once again and num equals to zero so forth.
And that here will have clearing out the hole from the fish shears because we cannot do right now have
are idle idle idle manager manager to gain to be equal to num so we are going to do this all then and
then we're going to have I mean we're going to do this later on scene manager and scream like this show
do not get confused by these let's call these comments.
This is just so when I once at Idol manager or I can go back to the hook and know what is missing.
So I know what can I add one more once more.
So yeah right now when I start we should have a start and finish for our hook.
So like we start fishing we catch some fishes or actually did not catch anything.
But once that is done we should go back.
So that is only the real problem that we have for now.
And it's still a problem.
We're still not going back.
Oh yeah we are.
As you can see why we had the where we had what's called the the the the the the the the the point where
we should finish we are finished.
So here is top fishing.
Like this everything seems to work fine.
I mean it is a do you.
It made does not look like it but you will see once we have added the fishes and so on to our guys that
will be it for this video.
Amar and I will see you guys in the next.