All language subtitles for 4. HP System

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
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 Download
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: 0 1 00:00:00,030 --> 00:00:02,190 Let's now look at the HP system. 1 2 00:00:02,220 --> 00:00:04,950 You'll find this system in the demo folder. 2 3 00:00:04,950 --> 00:00:07,200 prefabs/systems/HPSystem 3 4 00:00:07,200 --> 00:00:09,660 The HP system is a critical part of the project. 4 5 00:00:09,720 --> 00:00:14,610 It allows objects to have life and get destroyed if they take enough damage. 5 6 00:00:14,760 --> 00:00:19,440 Most of the code here is actually to update the health bar (UI) associated with it. 6 7 00:00:19,440 --> 00:00:24,090 And all of the children objects here handle the health bar and the health healing effect. 7 8 00:00:24,240 --> 00:00:29,430 The lasted time, which when it'll get triggered, it'll regenerate health and the health regeneration 8 9 00:00:29,430 --> 00:00:29,990 animation. 9 10 00:00:30,000 --> 00:00:38,190 So, functionality wise HP system has two important features the maximum HP and the current HP. When take 10 11 00:00:38,190 --> 00:00:39,000 damage is called. 11 12 00:00:39,120 --> 00:00:44,250 This is the most important function because when things damage is called, then we need to subtract 12 13 00:00:44,250 --> 00:00:47,970 the amount from the current HP and if it reaches zero. 13 14 00:00:48,000 --> 00:00:52,650 If the current HP reaches zero for the first time, we can check if it reaches zero, but we don't 14 15 00:00:52,650 --> 00:00:53,610 know if it's the first time. 15 16 00:00:53,620 --> 00:00:58,350 This is what is_alive is for. Because if is the first time, then is_alive is true and then 16 17 00:00:58,350 --> 00:01:05,310 it gets false and then it won't be true for the next time the current HP gets below zero. And the HP 17 18 00:01:05,310 --> 00:01:10,020 system actually has two signals on_damage_taken and on_destroyed. 18 19 00:01:10,050 --> 00:01:13,010 When it gets hit on damage taken happens. 19 20 00:01:13,020 --> 00:01:18,660 And this is important for the enemies when they get hit by the player to actually acquire the target 20 21 00:01:18,660 --> 00:01:20,880 and when on_destroyed happens. 21 22 00:01:21,030 --> 00:01:26,370 This is important because we need to actually destroy the object, but you don't want it to be destroyed 22 23 00:01:26,370 --> 00:01:32,250 here in HP system because there are some other steps that need to be taken to destroy other objects (referenced by this one). 23 24 00:01:32,250 --> 00:01:37,890 It's important to get the signal and then use it for later purposes. 24 25 00:01:37,920 --> 00:01:42,660 The other main functionality of the HP system is regenerating health. 25 26 00:01:42,900 --> 00:01:48,690 As you can see here, if the HP system receives damage, the last hit timer gets reset. 26 27 00:01:48,720 --> 00:01:49,770 Once the lasthit_timer 27 28 00:01:49,770 --> 00:01:50,650 is 0 28 29 00:01:50,760 --> 00:01:53,550 Then the should_heal variable is set to true. 29 30 00:01:53,580 --> 00:01:57,990 And this means that from this moment on, the HP will heal itself. 30 31 00:01:58,020 --> 00:01:59,390 How is this happening? 31 32 00:01:59,400 --> 00:02:04,830 At every frame, if should heal is true, then the current HP gets added. 32 33 00:02:04,830 --> 00:02:11,790 The healing factor * delta, and if the current HP is equal or more than maximum HP then we set 33 34 00:02:11,790 --> 00:02:16,110 it to be maximum HP. And then the animation player stops the animation. 34 35 00:02:16,140 --> 00:02:21,660 This is just an animation that sets everything to zero and of course it updates the UI. 35 36 00:02:21,720 --> 00:02:28,080 The UI is basically this bar, which is actually a gradient that has two values. 36 37 00:02:28,350 --> 00:02:31,380 I'll quickly show you what it does. 37 38 00:02:31,380 --> 00:02:38,430 First, we get the gradient from this one and we set the offsets of this one. 38 39 00:02:39,180 --> 00:02:44,580 But when update HP ui happens, it sets the two colors. 39 40 00:02:44,580 --> 00:02:51,780 The first one with index zero is red and then the green one because first we have everything green. 40 41 00:02:51,870 --> 00:02:56,690 The red will start from the left, but it will start from nothing. 41 42 00:02:56,700 --> 00:02:58,560 And then we set the offsets of these. 42 43 00:02:58,590 --> 00:03:04,230 If the player or the enemy gets more and more damage, these will change. 43 44 00:03:04,230 --> 00:03:06,050 I'll quickly show you. 44 45 00:03:06,060 --> 00:03:14,550 This is the red it has like nothing happening, but once it starts taking damage, the offsets move. 45 46 00:03:15,360 --> 00:03:17,160 The red is more than green 46 47 00:03:17,160 --> 00:03:23,550 now. If I go far away, then at some point my healing will kick in. 47 48 00:03:23,940 --> 00:03:31,980 This is the healing animation. It's just basically fade in / fade out for that background, but it will 48 49 00:03:31,980 --> 00:03:33,630 actually slowly heal me. 49 50 00:03:33,930 --> 00:03:40,020 And this can be tweaked here at the Heal Factor, so you can adjust it as much as you want. 50 51 00:03:40,320 --> 00:03:45,510 Lastly, what I want to mention is that the system is meant to be integrated below the kinematic body 51 52 00:03:45,510 --> 00:03:47,130 of either the player or the enemy. 52 53 00:03:47,130 --> 00:03:53,250 And this is needed because once this object gets detected from the projectile collision, they will 53 54 00:03:53,250 --> 00:03:55,260 ask for the HP system directly. 54 55 00:03:55,260 --> 00:03:57,720 It's important for the HP system to be here. 55 56 00:03:57,810 --> 00:04:02,880 Otherwise, if the hierarchy were different for the player and the enemy, then it would have been a 56 57 00:04:02,880 --> 00:04:05,060 mess of a code to make everything work. 57 58 00:04:05,070 --> 00:04:11,020 This is why it's important that the HP system is a child of the object that takes the collision directly. 58 59 00:04:11,040 --> 00:04:12,810 Basically, this is the HP system. 59 60 00:04:12,810 --> 00:04:15,930 I hope you like it and leave me a comment if you did. 6398

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