Hello, guys.
In this video, I want to offer you a challenge.
And to be very honest, if you meet in time to time for the first time and you never worked with that
time and unity before, I think it's going to be very complicated to do that, because I honestly remember
myself when I tried to do stuff like that for the first time.
I was really, really frustrated.
But still, let's see what you can do.
Let's see how you can handle it.
And then I'm going to show you how to do it.
So the task here is to make cool down for a slight ability.
At the moment I can spam the slide and slide basically endlessly.
So we need to fix this.
Let's see if you can do that.
I'm going to count till two and then I'm going to show you how to do one too.
Okay, So we're going to go to player script and in the header of the slide info, we're going to make
two more variables.
First will be serialize field, private load, slide, cool down, and then another one private float.
Slide cool down counter.
All right, now let's go in the update and make it.
Slide cooldown counter minus equals time dot delta time.
Now let's go to slide button.
Find it.
And what we're going to do here is to add another condition.
If velocity is not equal to zero and if slide cool down counter is less than.
Zero.
So we can press this button only if counter less than zero.
And if it is, then we go and inside doing stuff we did before.
And we need to add another line here.
Slide cool down counter equals to slide cool down.
Should we add time here?
I'm going to set cool down to something like 2 seconds just to make sure it's working.
And I'll try to go to slide a lot.
Let's see if it works.
Yeah, it does.
I cannot spam my slide all the time like that.
You can see that, right?
If we may cool down bigger.
All right.
If we make it point five.
Then we can basically enter it again and again.
So how to balance it is up to you.
But I suggest we set down to something like one and see how it goes later.
That's good.
And we all set here.
Let's go to the next video.