All language subtitles for 21. Using Custom Resources for Upgrades

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian Download
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,256 --> 00:00:03,072 When our experience bar fills up we need to be a 2 00:00:03,328 --> 00:00:08,960 To be presented with an option to upgrade our abilities or require new build 3 00:00:09,472 --> 00:00:12,288 And so that's what we're going to be starting in this life 4 00:00:13,056 --> 00:00:15,360 So what we going to be using for our upgrade 5 00:00:15,616 --> 00:00:17,152 Is custom resource 6 00:00:17,664 --> 00:00:20,992 And where resource is it's essentially a file 7 00:00:21,248 --> 00:00:22,016 That 8 00:00:22,272 --> 00:00:23,296 Hoards a bind 9 00:00:23,552 --> 00:00:24,064 Cedar 10 00:00:24,320 --> 00:00:27,904 So the idea is that we're going to be able to create about these resources 11 00:00:28,160 --> 00:00:29,952 And then manually add it 12 00:00:30,208 --> 00:00:30,976 Some ass 13 00:00:31,232 --> 00:00:32,000 So that resource 14 00:00:32,256 --> 00:00:33,536 Within the Ed 15 00:00:34,048 --> 00:00:36,096 That we can done reference in code 16 00:00:36,352 --> 00:00:37,888 And so you'll see how that works 17 00:00:38,144 --> 00:00:42,752 Let's get into it so first let's go to the resources directory under our file system 18 00:00:43,264 --> 00:00:46,080 Let's create a new folder underneath that 19 00:00:46,336 --> 00:00:47,104 And cold 20 00:00:47,360 --> 00:00:48,128 Upgrades 21 00:00:50,176 --> 00:00:51,200 Right-click on up 22 00:00:51,712 --> 00:00:52,736 Selection new 23 00:00:52,992 --> 00:00:54,016 And then resource 24 00:00:54,528 --> 00:00:56,576 And these are all the research 25 00:00:56,832 --> 00:00:57,856 Is that we can 26 00:00:58,112 --> 00:00:59,648 Use if we wanted to 27 00:00:59,904 --> 00:01:01,677 Now we're not going to come anywhere close to using all these resources 28 00:01:01,679 --> 00:01:04,028 Subtitled by online-courses.club We compress knowledge for you! 29 00:01:04,028 --> 00:01:05,280 But you'll notice that we've actually you 30 00:01:05,536 --> 00:01:06,048 If you are red 31 00:01:06,560 --> 00:01:10,400 Sovereign Saints under the sheep to eat we've already created a circle 32 00:01:10,656 --> 00:01:11,424 Shape 2D 33 00:01:11,936 --> 00:01:12,960 And a rectangle 34 00:01:13,728 --> 00:01:15,776 So these are actually resources as well 35 00:01:16,544 --> 00:01:19,360 We've also been using textures across or Sprite 2D 36 00:01:19,616 --> 00:01:20,896 Which are another type of 37 00:01:21,408 --> 00:01:23,968 So resources basically anything that holds some 38 00:01:24,224 --> 00:01:25,760 Data that can be passed or 39 00:01:26,272 --> 00:01:28,064 What we're going to do is there any creative cost 40 00:01:28,320 --> 00:01:31,392 Resource so are we going to do is double click the root resource here 41 00:01:32,160 --> 00:01:33,952 And that's just going to give us a plane resource 42 00:01:34,720 --> 00:01:35,744 It's called this 43 00:01:36,256 --> 00:01:36,768 What's called 44 00:01:37,024 --> 00:01:37,792 Sword 45 00:01:38,048 --> 00:01:39,328 Underscore rate 46 00:01:39,840 --> 00:01:40,352 And save 47 00:01:40,608 --> 00:01:45,216 And have you got your upgrades for you should see that that's alright is there and you can double click 48 00:01:45,472 --> 00:01:46,240 To see 49 00:01:46,496 --> 00:01:48,288 That it will open up an inspector 50 00:01:48,544 --> 00:01:50,080 Now we actually have 51 00:01:50,336 --> 00:01:52,896 Done anything with this resource as a very bare bones 52 00:01:53,152 --> 00:01:55,456 Boil notice if there's a script section right here 53 00:01:55,968 --> 00:01:56,480 So we can 54 00:01:56,736 --> 00:01:57,504 Attach a 55 00:01:57,760 --> 00:01:58,784 2DS resource 56 00:01:59,296 --> 00:02:00,576 To make them work that way that way 57 00:02:00,832 --> 00:02:01,344 Time to work 58 00:02:01,600 --> 00:02:06,208 And so what I'm going to do is I'm going to create a new script under upgrade so right click up 59 00:02:06,464 --> 00:02:07,232 Create new 60 00:02:07,744 --> 00:02:12,352 Script in the Script dialogue we are going to rename this new script you were going to call 61 00:02:12,608 --> 00:02:13,632 Ability 62 00:02:14,400 --> 00:02:15,168 Upgrade 63 00:02:15,680 --> 00:02:16,192 Dodgy 64 00:02:16,448 --> 00:02:18,496 Mobility underscore upgrade 65 00:02:18,752 --> 00:02:19,520 Dodgy 66 00:02:19,776 --> 00:02:20,800 What's going on in creator 67 00:02:21,312 --> 00:02:22,848 What's double click to open 68 00:02:23,360 --> 00:02:27,456 Ok so we're going to want to change this first line here we're going to write extended 69 00:02:27,712 --> 00:02:32,832 Resource instead because we're going to be attaching the script to a resource not a no 70 00:02:33,344 --> 00:02:34,880 Export a couple 71 00:02:35,136 --> 00:02:35,648 Tips for going 72 00:02:36,160 --> 00:02:37,184 Do at Expo 73 00:02:38,720 --> 00:02:39,232 Name 74 00:02:39,488 --> 00:02:42,048 And then this is going to be a type of string 75 00:02:42,816 --> 00:02:43,840 Nice to another x 76 00:02:44,352 --> 00:02:44,864 Bar 77 00:02:45,120 --> 00:02:45,888 Description 78 00:02:46,912 --> 00:02:48,704 And this is also going to be another string 79 00:02:48,960 --> 00:02:51,264 Let's do another export as well 80 00:02:52,544 --> 00:02:56,640 And this is going to be a bar name what's a bar ID 81 00:02:57,920 --> 00:03:04,064 Ok so I'm just going to leave that as it is and then I'm going to go over to my sword read.to yes I'm 82 00:03:04,320 --> 00:03:05,600 Double-click that again 83 00:03:05,856 --> 00:03:08,672 And I'm going to drag the ability upgrade into the Script 84 00:03:09,440 --> 00:03:11,488 And as soon as I do that you can see that 85 00:03:11,744 --> 00:03:14,560 We've now got those three properties that we can 86 00:03:15,072 --> 00:03:19,936 And there's one thing we can do to make our description a little bit more out of the ball is we can actually do 87 00:03:20,192 --> 00:03:22,496 Export underscore multiline 88 00:03:22,752 --> 00:03:26,336 To tell her that it should be a big heading box so you can see now 89 00:03:26,592 --> 00:03:28,640 In the ability upgrade igd 90 00:03:29,152 --> 00:03:30,176 We can see 91 00:03:30,432 --> 00:03:34,016 A big description box and then we can click this button to bring up 92 00:03:34,272 --> 00:03:35,040 Full screen 93 00:03:35,296 --> 00:03:36,064 Text Window 94 00:03:36,320 --> 00:03:38,368 This is night if you're going to be riding a lot of 95 00:03:38,624 --> 00:03:39,392 As is the case 96 00:03:39,648 --> 00:03:42,720 Description so with our sword rate so I could weekend 97 00:03:42,976 --> 00:03:44,000 Go ahead and 98 00:03:44,256 --> 00:03:45,792 Felony feels so let's 99 00:03:46,048 --> 00:03:47,072 You sore 100 00:03:47,328 --> 00:03:49,120 Underscore rate for the ID 101 00:03:49,376 --> 00:03:51,424 And then our name let's say 102 00:03:52,192 --> 00:03:55,776 Sword quickness feel frida name this heavy one 103 00:03:56,288 --> 00:03:59,360 What we're going to do is going to write a quick description so I'm going to say 104 00:03:59,872 --> 00:04:00,896 Increases 105 00:04:01,664 --> 00:04:02,176 Sore 106 00:04:02,432 --> 00:04:03,712 A tag 107 00:04:04,224 --> 00:04:05,504 What's the Sea by 108 00:04:05,760 --> 00:04:06,272 10 109 00:04:06,784 --> 00:04:10,368 Of course maybe will change that number later but what does give it up bass 110 00:04:10,624 --> 00:04:11,136 Description 111 00:04:12,416 --> 00:04:12,928 So 112 00:04:13,184 --> 00:04:16,256 As the description States were going to be making the 113 00:04:16,512 --> 00:04:17,536 Ability upgrades 114 00:04:18,047 --> 00:04:19,327 Change the speed 115 00:04:19,583 --> 00:04:21,375 Are the swords attack 116 00:04:21,887 --> 00:04:24,959 The thing about this is that this can actually be stopped 117 00:04:25,215 --> 00:04:27,007 As well so we can present this 118 00:04:27,263 --> 00:04:29,311 Upgrade to the player multiple times 119 00:04:29,823 --> 00:04:31,103 As a way of upgrading 120 00:04:31,615 --> 00:04:32,639 Disorder even more 121 00:04:32,895 --> 00:04:36,735 And one final thing that we're going to do is let's go back door ability upgrades 122 00:04:37,247 --> 00:04:38,271 And let's just call 123 00:04:38,527 --> 00:04:39,295 Classname 124 00:04:39,551 --> 00:04:41,087 Class underscore name ability 125 00:04:41,343 --> 00:04:42,111 Upgrade 126 00:04:42,879 --> 00:04:46,207 That's going to help quite a bit in the future so we're just going to a site 127 00:04:46,463 --> 00:04:47,231 Neck last name 128 00:04:47,487 --> 00:04:53,631 And it looks like we're good girl alright so let's create a new note so go ahead and go over to your scene dark 129 00:04:55,167 --> 00:04:56,191 Hit control pen 130 00:04:56,447 --> 00:04:57,727 To start a new scene 131 00:04:57,983 --> 00:04:59,519 And then make it a route to 132 00:04:59,775 --> 00:05:01,311 Of a plane no 133 00:05:01,823 --> 00:05:03,359 Call days upgrade 134 00:05:03,871 --> 00:05:04,383 Manager 135 00:05:05,407 --> 00:05:06,943 Let's go ahead and save 136 00:05:07,455 --> 00:05:07,967 In 137 00:05:08,223 --> 00:05:10,527 Oursainsburys.co up to your room 138 00:05:10,783 --> 00:05:11,551 Directory 139 00:05:13,087 --> 00:05:16,927 And then in manager were going to save it alongside those 140 00:05:17,951 --> 00:05:18,463 Ok 141 00:05:18,719 --> 00:05:19,743 Add a script 142 00:05:20,255 --> 00:05:21,023 Default setting 143 00:05:21,279 --> 00:05:23,327 Should be just fine so we're gonna touch that 144 00:05:23,583 --> 00:05:25,375 And in this upgrade managers 145 00:05:25,631 --> 00:05:27,423 Let's go ahead and create an 146 00:05:27,679 --> 00:05:28,191 Sport 147 00:05:28,447 --> 00:05:30,751 And what we're going to do is really cold as far 148 00:05:33,311 --> 00:05:35,359 What's upgrade pool 149 00:05:35,871 --> 00:05:39,199 And then a colon were going to type it as an array of 150 00:05:39,455 --> 00:05:40,735 Ability opera 151 00:05:41,759 --> 00:05:43,295 So this is going to be 152 00:05:43,551 --> 00:05:47,391 Our customer resource here we can export that as an array 153 00:05:47,647 --> 00:05:48,415 In inspector 154 00:05:48,671 --> 00:05:51,487 If you look at the inspector we now have an upgrade pool 155 00:05:51,743 --> 00:05:54,303 Where we can edit this size 156 00:05:54,559 --> 00:05:58,399 And elements so if I go ahead and increase the size or a 157 00:05:58,655 --> 00:06:00,703 I can't click add element by 1 158 00:06:00,959 --> 00:06:03,519 Or I can increase the size with this 159 00:06:03,775 --> 00:06:04,287 Size 160 00:06:04,799 --> 00:06:05,567 Spinner here 161 00:06:06,591 --> 00:06:08,383 We want one element to exist 162 00:06:08,895 --> 00:06:11,711 Then I can drag over our sword rate into 163 00:06:12,479 --> 00:06:15,039 And so typing it as an ability up 164 00:06:15,551 --> 00:06:17,087 Are allowed us to 165 00:06:17,343 --> 00:06:18,623 Only drag over 166 00:06:18,879 --> 00:06:19,647 Anything that 167 00:06:19,903 --> 00:06:23,231 Has a class name of a billion inherit from a billion 168 00:06:23,487 --> 00:06:23,999 Now 169 00:06:24,255 --> 00:06:27,071 You note that if this is not working If You Can 170 00:06:27,327 --> 00:06:29,375 Strike the sword rate over into here 171 00:06:29,631 --> 00:06:35,007 You may need to restart your goodle editor this is a known issue at least in the version that I'm using 172 00:06:35,263 --> 00:06:36,287 Which is rc1 173 00:06:36,543 --> 00:06:37,567 You're probably on 174 00:06:38,079 --> 00:06:39,615 4.0 stable 175 00:06:39,871 --> 00:06:43,967 But again if that's not working just going to restart your editor and it should work 176 00:06:44,479 --> 00:06:47,295 Ok so that's our upgrade Paul and we've got 177 00:06:48,063 --> 00:06:48,575 Sore 178 00:06:48,831 --> 00:06:50,111 Rate good girl 179 00:06:51,135 --> 00:06:54,207 Serena go back to our main scene in switch on over bed 180 00:06:54,463 --> 00:06:55,231 The 2DS 181 00:06:55,487 --> 00:06:58,559 So we've got the experience manager lit open up the Script 182 00:06:58,815 --> 00:07:00,351 So this experience manager 183 00:07:00,607 --> 00:07:01,631 Responsible for 184 00:07:01,887 --> 00:07:03,423 Incrementing the experience 185 00:07:03,679 --> 00:07:04,703 And telling us States 186 00:07:04,959 --> 00:07:05,471 Update 187 00:07:05,983 --> 00:07:08,543 So I'm going to want to have a level up signal as well 188 00:07:08,799 --> 00:07:09,823 So let's 189 00:07:10,079 --> 00:07:10,591 What's this 190 00:07:10,847 --> 00:07:11,871 Experience manager script 191 00:07:12,383 --> 00:07:13,407 Never get another 192 00:07:13,663 --> 00:07:14,175 Cigna 193 00:07:14,687 --> 00:07:15,455 Leveller 194 00:07:15,967 --> 00:07:17,503 Sandwiches 195 00:07:18,015 --> 00:07:20,319 New underscore level 196 00:07:21,087 --> 00:07:21,855 Chadderton 197 00:07:22,623 --> 00:07:24,927 So we're going to pass in the new level 198 00:07:25,439 --> 00:07:27,743 Two player just reached in the level up signal 199 00:07:28,511 --> 00:07:30,815 And we're gonna make that here so again 200 00:07:31,071 --> 00:07:33,119 Experienced updated first underneath this 201 00:07:33,375 --> 00:07:34,399 Black in ink 202 00:07:34,655 --> 00:07:35,167 Experience 203 00:07:35,679 --> 00:07:38,239 Emma is going to go ahead and level up 204 00:07:39,775 --> 00:07:41,311 And what are we going to 205 00:07:42,079 --> 00:07:43,359 We are going to Amy 206 00:07:43,615 --> 00:07:45,151 What's the current underscore 207 00:07:45,663 --> 00:07:46,175 Level 208 00:07:47,455 --> 00:07:51,551 So let's go ahead in our main let's instantiate a child scene 209 00:07:51,807 --> 00:07:53,343 Instantiate upgrade manager 210 00:07:53,855 --> 00:07:56,671 Garden products somewhere near the top with the other 211 00:07:56,927 --> 00:08:03,071 Energies opera manager we probably want to connect to this level up so that we can actually a sign 212 00:08:03,327 --> 00:08:04,095 An upgrade 213 00:08:04,351 --> 00:08:04,863 The player 214 00:08:05,119 --> 00:08:08,447 So what I'm gonna do is I'm going to click into the upgrade manager 215 00:08:08,959 --> 00:08:10,495 And I'm going to export 216 00:08:10,751 --> 00:08:11,775 A variable 217 00:08:12,287 --> 00:08:13,567 I'm going to call it Xperia 218 00:08:13,823 --> 00:08:14,335 Manager 219 00:08:15,359 --> 00:08:16,895 Export that as no 220 00:08:17,407 --> 00:08:19,711 And then we're going to override the ready method 221 00:08:19,967 --> 00:08:21,503 Funk underscore 222 00:08:22,015 --> 00:08:23,807 We're gonna say experience manager 223 00:08:24,063 --> 00:08:24,575 Dad 224 00:08:24,831 --> 00:08:25,599 Level up 225 00:08:26,623 --> 00:08:28,415 So level underscore up.com 226 00:08:30,207 --> 00:08:31,487 On level 227 00:08:32,511 --> 00:08:34,559 What's define the on level up function 228 00:08:37,375 --> 00:08:38,399 And remember working 229 00:08:38,655 --> 00:08:41,215 Taking a level the current level as an Int 230 00:08:41,727 --> 00:08:43,519 So on level up beginning with k 231 00:08:43,775 --> 00:08:45,311 Rational problem that can be used 232 00:08:45,823 --> 00:08:46,335 Just 233 00:08:46,847 --> 00:08:48,639 But what are we going to do on level 12 234 00:08:48,895 --> 00:08:51,455 Going to ideally show you I'm 235 00:08:51,711 --> 00:08:53,759 But first let's just a sign 236 00:08:54,271 --> 00:08:54,783 That 237 00:08:55,039 --> 00:08:56,831 First upgrade that we have 238 00:08:57,343 --> 00:09:00,671 To the player so we're going to actually create a new variable in here 239 00:09:02,207 --> 00:09:02,719 Current 240 00:09:02,975 --> 00:09:04,255 Underscore upgrade 241 00:09:04,767 --> 00:09:07,327 Is equal to in regular use curly braces 242 00:09:07,583 --> 00:09:10,399 Because we are defining a new dictionary 243 00:09:10,911 --> 00:09:11,423 Now 244 00:09:11,679 --> 00:09:15,775 If you're taking this course you're probably familiar with programming generally 245 00:09:16,287 --> 00:09:18,079 But if you're not familiar with 246 00:09:18,335 --> 00:09:19,103 Dictionary 247 00:09:19,359 --> 00:09:23,711 Dictionaries are basically a way of assigning data to an AI 248 00:09:24,735 --> 00:09:27,039 So if I were to go into my current upgrades here 249 00:09:27,295 --> 00:09:28,319 And say 10 250 00:09:29,343 --> 00:09:30,111 Hello 251 00:09:30,367 --> 00:09:32,927 What will happen if I could reference 252 00:09:33,183 --> 00:09:35,231 This value hello bye 253 00:09:35,487 --> 00:09:36,255 Using the key 254 00:09:36,767 --> 00:09:39,327 So in other words I can do something like print 255 00:09:39,839 --> 00:09:41,631 Different upgrades and 256 00:09:42,655 --> 00:09:43,423 Brackets 257 00:09:43,935 --> 00:09:44,447 Test 258 00:09:44,703 --> 00:09:47,263 And that would resolve to hello 259 00:09:47,519 --> 00:09:49,823 This is just a nice way of 260 00:09:50,079 --> 00:09:52,127 Storing data that easy to look 261 00:09:52,639 --> 00:09:55,967 So we're going to just leave this empty this current upgrades 262 00:09:56,223 --> 00:09:56,735 For now 263 00:09:57,247 --> 00:09:59,039 Then I level up what are we going to do 264 00:09:59,295 --> 00:10:00,972 Well here's what we're going to do to manager ok 265 00:10:00,973 --> 00:10:03,144 Subtitled by online-courses.club We compress knowledge for you! 266 00:10:03,145 --> 00:10:04,415 Replace Google restore all of the upgrades we have 267 00:10:04,671 --> 00:10:05,183 In 268 00:10:05,439 --> 00:10:06,975 A dictionary object 269 00:10:07,231 --> 00:10:09,023 And we're going to key it bye 270 00:10:09,279 --> 00:10:10,303 The ID 271 00:10:10,559 --> 00:10:11,327 That we use 272 00:10:11,839 --> 00:10:13,119 Here in our swords 273 00:10:13,631 --> 00:10:15,935 So we're going to have sword right as our key 274 00:10:16,191 --> 00:10:19,007 And then we're going to store the actual resource 275 00:10:19,263 --> 00:10:20,287 In an hour 276 00:10:20,799 --> 00:10:23,615 And actually we meet use a nested dictionary 277 00:10:23,871 --> 00:10:24,639 Which will be really cool 278 00:10:24,895 --> 00:10:26,175 Ok so what are we going to 279 00:10:26,431 --> 00:10:27,455 So unravel 280 00:10:27,711 --> 00:10:28,735 We're going to first 281 00:10:29,247 --> 00:10:35,135 Pick a random upgrade from the upgrade pool and it's very easy so we're going to save our chosen underscore 282 00:10:37,183 --> 00:10:38,207 Is equal to 283 00:10:38,463 --> 00:10:39,743 Upgrade pool 284 00:10:39,999 --> 00:10:40,511 Picrew 285 00:10:41,023 --> 00:10:45,119 This is going to do is this is going to pick a random element out of that array 286 00:10:45,375 --> 00:10:49,215 And it's going to be possible for pick a random to return now so would you say 287 00:10:49,471 --> 00:10:51,263 Chosen upgrade is equal to now 288 00:10:51,519 --> 00:10:53,567 You can say what how is that possible 289 00:10:54,335 --> 00:10:54,847 Well 290 00:10:55,359 --> 00:11:00,223 If we start removing element from the array in the future like let's say that we have unique 291 00:11:00,479 --> 00:11:02,527 Upgrades that can only be chosen one 292 00:11:03,039 --> 00:11:08,671 That could potentially end up you know if we exhaust all of the passport upgrade then we say there are no more upgrades 293 00:11:09,183 --> 00:11:09,695 Then 294 00:11:09,951 --> 00:11:13,023 You could potentially be trying to pick an element from an empty array 295 00:11:13,279 --> 00:11:17,119 So it doesn't hurt to be defensive especially when it's really easy to do something like this 296 00:11:17,631 --> 00:11:20,447 So the next thing that we want to do is we want to see 297 00:11:20,703 --> 00:11:22,239 Does this current upgrade 298 00:11:22,751 --> 00:11:25,567 Have a key that matches Archie 299 00:11:25,823 --> 00:11:26,335 Upgrade 300 00:11:26,591 --> 00:11:28,895 So what we're going to do is really save our has 301 00:11:29,151 --> 00:11:30,943 Upgrade is equal to 302 00:11:31,199 --> 00:11:32,735 Upgrades 303 00:11:33,247 --> 00:11:33,759 Has 304 00:11:34,527 --> 00:11:36,831 And in our has we're going to pass in 305 00:11:37,343 --> 00:11:38,879 Chosen upgrade at 306 00:11:39,391 --> 00:11:40,159 I D 307 00:11:40,671 --> 00:11:45,535 Now we want to get typing as what we can do as we can say as ability upgrade right here 308 00:11:45,791 --> 00:11:46,815 And now we should 309 00:11:47,327 --> 00:11:47,839 H 310 00:11:48,095 --> 00:11:49,631 Suggestions for ID 311 00:11:51,935 --> 00:11:53,215 If not 312 00:11:53,727 --> 00:11:54,751 Has upgrade 313 00:11:55,263 --> 00:11:58,079 Then what we want to do well we want to say current upgrade 314 00:11:59,359 --> 00:12:00,895 Anarchy it bye 315 00:12:01,151 --> 00:12:02,431 Chosen upgrade 316 00:12:04,479 --> 00:12:05,247 I D 317 00:12:05,759 --> 00:12:06,783 Is equal to 318 00:12:07,039 --> 00:12:10,367 We're going to create a nested dictionary in here 319 00:12:10,879 --> 00:12:12,159 I'm not going the same 320 00:12:12,415 --> 00:12:14,207 Is we are just going to 321 00:12:14,463 --> 00:12:17,023 Store a reference to The Resource so resource 322 00:12:17,279 --> 00:12:18,047 Is chosen 323 00:12:20,351 --> 00:12:23,423 So this is our actual ability resource file 324 00:12:24,191 --> 00:12:25,983 And this needs to be in 325 00:12:26,495 --> 00:12:27,519 Quotes just likes 326 00:12:27,775 --> 00:12:29,567 Serena pass in our children upgrade 327 00:12:29,823 --> 00:12:30,847 At The Resource key 328 00:12:31,359 --> 00:12:32,895 And then we're going to do in Cork 329 00:12:33,151 --> 00:12:33,919 Quantity 330 00:12:35,199 --> 00:12:36,479 And then we're just going to send it to 331 00:12:36,735 --> 00:12:37,759 Ok so 332 00:12:38,015 --> 00:12:39,039 This is basically saying 333 00:12:39,295 --> 00:12:43,647 Create a new object at the key which in this case will be sorted underscore 334 00:12:44,159 --> 00:12:50,047 And that object is going to have a reference to the ability upgrade resource 335 00:12:50,559 --> 00:12:51,327 That we 336 00:12:51,583 --> 00:12:52,095 Shows 337 00:12:52,351 --> 00:12:53,631 And then it's going to set up 338 00:12:53,887 --> 00:12:54,399 U2 One 339 00:12:54,655 --> 00:12:55,679 Now watch what happened 340 00:12:56,191 --> 00:12:57,471 If we say else 341 00:12:58,495 --> 00:13:02,079 So if we already have this key in the dictionary what are we going to do 342 00:13:02,335 --> 00:13:03,871 Bring us a current upgrades 343 00:13:04,639 --> 00:13:06,175 Androgen index it by 344 00:13:06,687 --> 00:13:07,967 Chosen upgrade 345 00:13:09,759 --> 00:13:12,063 And I'm going to do another index here 346 00:13:12,575 --> 00:13:13,343 Which is going to be 347 00:13:13,599 --> 00:13:14,367 Quality 348 00:13:14,879 --> 00:13:15,903 Classical 349 00:13:16,927 --> 00:13:18,719 Oh sorry this is should be quiet 350 00:13:19,487 --> 00:13:19,999 Quantity 351 00:13:20,767 --> 00:13:22,559 So you're saying ok well 352 00:13:22,815 --> 00:13:26,655 If we already have the upgrade we have at least one 353 00:13:26,911 --> 00:13:29,215 That means that we can just increment the quantity 354 00:13:29,471 --> 00:13:29,983 Bye 355 00:13:30,239 --> 00:13:30,751 1 356 00:13:31,007 --> 00:13:34,335 Ok just for debug purposes we going to write another line at the bottom 357 00:13:34,847 --> 00:13:35,359 Print 358 00:13:35,615 --> 00:13:37,407 And then we're going to print a current upgrades 359 00:13:37,919 --> 00:13:39,967 This is going to allow us to see 360 00:13:41,247 --> 00:13:45,087 Our upgrades are actually working when the player levels up 361 00:13:45,343 --> 00:13:45,855 So 362 00:13:46,111 --> 00:13:51,231 This is not going to be the final stage we are going to introduce a UI with the player can choose an upgrade 363 00:13:51,487 --> 00:13:54,047 But just to make sure that the upgrade is actually 364 00:13:54,559 --> 00:13:56,095 The data flows actually work 365 00:13:56,351 --> 00:13:57,887 We're just doing it directly for now 366 00:13:58,143 --> 00:13:59,167 Let's Run the game 367 00:13:59,423 --> 00:14:02,751 Because I forgot to assign my experience manner 368 00:14:03,263 --> 00:14:06,591 So let's go ahead and go to my upgrade manager in my sim three 369 00:14:06,847 --> 00:14:07,871 And leads 370 00:14:08,127 --> 00:14:10,175 Drag the experience manager 371 00:14:10,431 --> 00:14:12,735 Into that experience manager now that the 372 00:14:13,247 --> 00:14:14,527 Ok so let's try this is 373 00:14:15,039 --> 00:14:16,575 As I'm going to go ahead and collect 374 00:14:16,831 --> 00:14:17,855 All these vile 375 00:14:20,159 --> 00:14:20,671 Ok 376 00:14:20,927 --> 00:14:25,791 So I just collected my face veil and levelled up let's go ahead and go over 377 00:14:26,047 --> 00:14:27,583 2 hour hour 378 00:14:27,839 --> 00:14:29,119 And you can see down here 379 00:14:29,631 --> 00:14:30,143 Lad 380 00:14:30,399 --> 00:14:31,679 Here's my object 381 00:14:31,935 --> 00:14:35,007 So I've got my sword rate which is the ID of a resource 382 00:14:35,263 --> 00:14:38,591 It is referencing a resource in memory 383 00:14:38,847 --> 00:14:40,127 And has a quantity of 1 384 00:14:40,383 --> 00:14:43,199 And you can see that while I've got the game on the other screen 385 00:14:43,711 --> 00:14:46,783 That I just levelled up again and now the quantity is 2 386 00:14:47,039 --> 00:14:52,159 So this is how I gonna keep track of all of our upgrades there each upgrade is going to have its own key 387 00:14:52,415 --> 00:14:53,695 In this dictionary 388 00:14:53,951 --> 00:14:57,279 And then we'll be able to keep track of how many times upgrade has been collect 389 00:14:57,535 --> 00:15:02,655 And then what we're going to do is we're going to have to handle these upgrades in each individual ability 390 00:15:04,191 --> 00:15:06,239 So that's the initial 391 00:15:06,751 --> 00:15:07,775 That's required 392 00:15:08,799 --> 00:15:11,615 Ability upgrades working I'm going to remove this prints 393 00:15:11,871 --> 00:15:12,383 For now 394 00:15:12,639 --> 00:15:13,919 Because we no longer need it 395 00:15:14,431 --> 00:15:15,711 And in the 396 00:15:15,967 --> 00:15:16,991 Next lesson 397 00:15:17,247 --> 00:15:18,015 We are going 398 00:15:18,271 --> 00:15:19,039 Go over 399 00:15:19,295 --> 00:15:22,879 How do you actually choose this upgrade with a u 26468

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