1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:02,000
In this video, I want to offer you a challenge.

3
00:00:02,000 --> 00:00:08,000
And to be very honest, if you meet in time to time for the first time and you never worked with that

4
00:00:08,000 --> 00:00:14,000
time and unity before, I think it's going to be very complicated to do that, because I honestly remember

5
00:00:14,000 --> 00:00:18,000
myself when I tried to do stuff like that for the first time.

6
00:00:18,000 --> 00:00:19,000
I was really, really frustrated.

7
00:00:19,000 --> 00:00:21,000
But still, let's see what you can do.

8
00:00:21,000 --> 00:00:22,000
Let's see how you can handle it.

9
00:00:22,000 --> 00:00:24,000
And then I'm going to show you how to do it.

10
00:00:24,000 --> 00:00:27,000
So the task here is to make cool down for a slight ability.

11
00:00:27,000 --> 00:00:32,000
At the moment I can spam the slide and slide basically endlessly.

12
00:00:32,000 --> 00:00:33,000
So we need to fix this.

13
00:00:33,000 --> 00:00:34,000
Let's see if you can do that.

14
00:00:34,000 --> 00:00:41,000
I'm going to count till two and then I'm going to show you how to do one too.

15
00:00:41,000 --> 00:00:47,000
Okay, So we're going to go to player script and in the header of the slide info, we're going to make

16
00:00:47,000 --> 00:00:49,000
two more variables.

17
00:00:49,000 --> 00:01:01,000
First will be serialize field, private load, slide, cool down, and then another one private float.

18
00:01:01,000 --> 00:01:05,000
Slide cool down counter.

19
00:01:05,000 --> 00:01:09,000
All right, now let's go in the update and make it.

20
00:01:10,000 --> 00:01:15,000
Slide cooldown counter minus equals time dot delta time.

21
00:01:15,000 --> 00:01:18,000
Now let's go to slide button.

22
00:01:18,000 --> 00:01:18,000
Find it.

23
00:01:18,000 --> 00:01:22,000
And what we're going to do here is to add another condition.

24
00:01:22,000 --> 00:01:30,000
If velocity is not equal to zero and if slide cool down counter is less than.

25
00:01:31,000 --> 00:01:31,000
Zero.

26
00:01:32,000 --> 00:01:35,000
So we can press this button only if counter less than zero.

27
00:01:35,000 --> 00:01:40,000
And if it is, then we go and inside doing stuff we did before.

28
00:01:40,000 --> 00:01:42,000
And we need to add another line here.

29
00:01:42,000 --> 00:01:47,000
Slide cool down counter equals to slide cool down.

30
00:01:49,000 --> 00:01:50,000
Should we add time here?

31
00:01:51,000 --> 00:01:56,000
I'm going to set cool down to something like 2 seconds just to make sure it's working.

32
00:01:56,000 --> 00:01:58,000
And I'll try to go to slide a lot.

33
00:01:58,000 --> 00:02:00,000
Let's see if it works.

34
00:02:00,000 --> 00:02:01,000
Yeah, it does.

35
00:02:01,000 --> 00:02:04,000
I cannot spam my slide all the time like that.

36
00:02:04,000 --> 00:02:05,000
You can see that, right?

37
00:02:05,000 --> 00:02:07,000
If we may cool down bigger.

38
00:02:12,000 --> 00:02:12,000
All right.

39
00:02:12,000 --> 00:02:15,000
If we make it point five.

40
00:02:16,000 --> 00:02:18,000
Then we can basically enter it again and again.

41
00:02:18,000 --> 00:02:20,000
So how to balance it is up to you.

42
00:02:20,000 --> 00:02:25,000
But I suggest we set down to something like one and see how it goes later.

43
00:02:25,000 --> 00:02:27,000
That's good.

44
00:02:27,000 --> 00:02:28,000
And we all set here.

45
00:02:28,000 --> 00:02:30,000
Let's go to the next video.

