All language subtitles for 19. WaveConfig For Path & Speed

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

1 1

[MUSIC] 2

2

In this video, we're gonna shift the movement speed and 3

3

the wave configuration that has its waypoints in it off the enemy and 4

4

have all that information within the enemy spawner and the waves themselves. 5

5

So the enemy is clever in knowing what path to follow, without us having to go 6

6

and link all of those things onto a particular enemy prefab itself. 7

7

Why do this? 8

8

Well this is so 9

9

we can have this particular enemy come in at different speeds and 10

10

go on different paths and not always have to go on the same path every single time. 11

11

I think that's gonna give us a lot more creativity. 12

12

So what we'll start off with is jumping over into the enemy pathing script. 13

13

We haven't used that for a lecture or two. 14

14

Enemy pathing is what we will be looking at. 15

15

And I'm gonna start here by highlighting the fact that we need to or 16

16

we can remove some of our SerializedFields. 17

17

So we still need to have our WaveConfig variable but 18

18

we don't need access to it anymore. 19

19

So that will no longer show up on the enemy in the inspector. 20

20

And likewise, this float moveSpeed, 21

21

we're going to remove completely and replace it with something else. 22

22

And what'll we replace it with? 23

23

Well, here's a little challenge for you. 24

24

I want you to get the speed for the enemies from the WaveConfig data 25

25

instead of using moveSpeed, which I just deleted. 26

26

So find where moveSpeed is, or in my case was, and 27

27

instead of using that moveSpeed variable, get the information from the WaveConfig. 28

28

Okay, so there's your challenge. 29

29

Pause the video and jump into that now. 30

30

Welcome back. 31

31

Hopefully you are taking on the challenges. 32

32

They are the absolute number one best way to learn. 33

33

That's why you're taking this course and 34

34

not just watching along some random YouTube videos. 35

35

This is the process of learning cuz you're taking on the challenges, 36

36

I hope as the best way to learn. 37

37

So you can see now cuz I've delayed moveSpeed, got the squiggly red line. 38

38

Instead of moveSpeed, we need to access our waveConfig., what's its gonna be? 39

39

GetMoveSpeed, it's highlighted already, GetMoveSpeed and 40

40

then we need our parentheses cuz it is a method. 41

41

So, now it's going to go into our waveConfig, get the particular 42

42

movement speed that we've set for this wave and then use that for our enemy. 43

43

Now, in terms of the wave configuration, to know which wave to follow, so 44

44

that we don't have to connect it up manually. 45

45

We're going to add ourselves a new public method that, in here, 46

46

has the information that we feed into our particular waypoint. 47

47

So you can see this is following our path, we need to know which path to follow. 48

48

And to do that, we want something else to be telling us that from another script. 49

49

So what we'll do is we'll create ourselves a public method, 50

50

say public void, set, we'll call this SetWaveConfig. 51

51

Now we've been doing, I'm just going to leave that midway through, 52

52

just remind you in our waveConfigs. 53

53

We've been doing these get methods where we say hey, return me a value and 54

54

that value we've established in our waveConfig file. 55

55

In this instance, we're gonna say hey, set the particular thing for me. 56

56

So it's a public method that something else can be feeding into 57

57

a value into this script. 58

58

So it's a set method, if you will. 59

59

And in here, we put inside the parentheses, what is it? 60

60

What's the information that we need to have when this is called? 61

61

So as soon as we have parameters in our signature here, SetWaveConfig. 62

62

As soon as we put something in here and I'm gonna put in waveConfig, so it's of 63

63

type waveConfig, we'll call it waveConfig cuz that's what we need to know. 64

64

We want to know what is the waveConfig that we should be following for 65

65

this current enemy on this current path. 66

66

And so, when anything calls this public method, 67

67

it has to also tell us what the waveConfig is. 68

68

If it doesn't do that, if in another script if we just say SetWaveConfig and 69

69

open close parentheses, semicolon. 70

70

If we just do that, 71

71

then we're going to get an error because we've constructed our method here, 72

72

saying you have to give me, thou shall give me the waveConfig information. 73

73

So when we are calling our method from another place, which we'll do in just 74

74

a moment, we actually have to put in there what the waveConfig is. 75

75

So that this waveConfig is getting fed into here. 76

76

So we know that this becomes a container for 77

77

whatever it was that this waveConfig is in the other file. 78

78

Okay, just going nice and slow on that because I know it puzzled me for 79

79

a long time in terms of what's this stuff inside the brackets? 80

80

Well the main thing to know is that we are wanting information from 81

81

whoever called this. 82

82

Now, this part is going to blow your mind if you're not paying attention. 83

83

So, get ready to pay some attention. 84

84

What we need to do here is to set the waveConfig variable in this class, 85

85

which is up here, we've set this as waveConfig. 86

86

And we're using this waveConfig variable in a number of spots down here to say 87

87

okay, what I'm I following? 88

88

What I'm I heading towards in terms of my waveConfig? 89

89

But then we also this concept of the waveConfig local variable to this method, 90

90

which is being passed back in. 91

91

Now we could call this something different like waveConfigToSet. 92

92

We could do that but at the end of the day, it's a waveConfig. 93

93

So we're gonna use the same word, waveConfig but it has two slightly 94

94

different meanings or they're slightly different variables. 95

95

So what I'm going to say in here is this.Wave, 96

96

sorry, little w, waveConfig = waveConfig, okay? 97

97

And again, I'm gonna go slow on this so it's super duper clear, 98

98

I'll just get rid of some of my white space. 99

99

Super clear, when we say this in front of waveConfig, 100

100

we're referring to this in the class, the instance variable. 101

101

So at the top here, this variable can be used throughout our entire class, 102

102

our entire instance. 103

103

Therefore, it is this, this is the thing that we're on, this is the script, 104

104

the class, the document. 105

105

When we use this, referring to this whole thing. 106

106

So this.waveConfig is referring to this particular waveConfig and 107

107

then it equals the waveConfig that we receive when something calls 108

108

the public method SetWaveConfig and passes to us the waveConfig. 109

109

Okay, I'm gonna save up this and then go to the spot where we are. 110

110

I'm going to call the waveConfig and I'll show you what I mean. 111

111

So over into EnemySpawner, instead of just instantiating, 112

112

we're gonna create a new variable, which we'll say var 113

113

newEnemy = Instantiate and then what and where and the rotation. 114

114

So now we're storing this new enemy each time we create an enemy, 115

115

it will be newEnemy. 116

116

And that allows us to grab the component, so 117

117

if we give ourselves a line between the end of our instantiation and 118

118

before the yield, we'll type in newEnemy. 119

119

So, we're referring to this newEnemy we've just created dot. 120

120

So there's something within the newEnemy that we're looking for. 121

121

GetComponent, With our angle braces cuz 122

122

when we create this game object, we're looking for a particular thing. 123

123

The component we're looking for is the enemy pathing. 124

124

So that's the enemy pathing script. 125

125

Then when we have a look at our enemy, you can see, if I find an enemy, you can see 126

126

it has a script and the script is also a component that's sitting on the enemy, 127

127

that's how we can access it using getComponent. 128

128

Then we need to add our parentheses after 129

129

enemy pathing.SetWaveConfig that we just created. 130

130

And what do we need to feed into that? 131

131

We need to feed in, you guessed it, the waveConfig. 132

132

And which wave and then put a semicolon on the end. 133

133

Which waveConfig they're referring to? 134

134

It's the waveConfig that's locally within the SpawnAllEnemies. 135

135

So it knows, this is the particular wave that I'm referring to. 136

136

And then when we call this method, it's going to pass in this waveConfig 137

137

that we're getting from here into our enemy pathing because it required us. 138

138

It said, you have to give me this information when you 139

139

are calling SetWaveConfig and I'm gonna use this information 140

140

to define my own waveConfig in my particular class. 141

141

Okay, let's save all of these, I've jumped back over into Unity, click on our enemy. 142

142

Those extra bits and pieces are no longer there. 143

143

Let's go find our waves. 144

144

Click on Wave 1. 145

145

I'm gonna change the movement speed to 8 and make sure this works. 146

146

Path zero, which one's path zero? 147

147

That's that one. 148

148

Okay, I'll change it to path one for now, 149

149

on wave one just to check that it works and then click on play. 150

150

We should have it coming from left to right, is it? 151

151

Or right to left? 152

152

Okay and they're going nice and fast, 153

153

it looks like they're definitely going eight amount of speed. 154

154

If I was to just change it over to the other path, to check this all works, 155

155

path zero and make the movement speed, I don't know, 20 just to be ridiculous. 156

156

Click on play and it should go zing and spawn, one, two, three, four, five. 157

157

Excellent, okay, there we go. 158

158

So now we've got more of our information stored on our wave. 159

159

The value in doing this is now we can create waves where we mix and 160

160

match the speed, the paths and 161

161

the enemies to give us a whole ton of variation within our game. 162

162

So, great work. 163

163

In the next video, we'll continue on with spawning more waves.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.