WEBVTT 1 00:00:23.440 --> 00:00:25.490 Hello, this is Younghoon Lee 2 00:00:25.580 --> 00:00:28.640 This time, we are going to apply the enemy asset 3 00:00:28.640 --> 00:00:31.520 and try processing animation 4 00:00:31.520 --> 00:00:35.240 In this unit, we're going to change the outer appearance of the enemy 5 00:00:35.240 --> 00:00:37.480 and use an animation blueprint 6 00:00:37.480 --> 00:00:41.279 to learn how to control it as a state machine 7 00:00:41.279 --> 00:00:45.119 And with the state machine created by C 8 00:00:45.119 --> 00:00:47.639 we're going to learn how to synchronize it with 9 00:00:47.639 --> 00:00:50.799 the state machine of the animation blueprint 10 00:00:50.799 --> 00:00:54.200 Finally, using the animation montage 11 00:00:54.200 --> 00:00:56.560 the attack and death animation 12 00:00:56.560 --> 00:00:59.200 will be configurated into one animation sequence 13 00:00:59.200 --> 00:01:01.599 and we'll learn how to control it 14 00:01:01.980 --> 00:01:05.062 Changing the outer appearance of the enemy and synchronizing the C FSM and animation FSM 15 00:01:06.881 --> 00:01:10.300 This time, we're going to change the appearance of the enemy 16 00:01:12.681 --> 00:01:14.400 The enemy looks like this right now 17 00:01:14.400 --> 00:01:19.080 We're going to change it 18 00:01:19.080 --> 00:01:22.959 We're going to use this 19 00:01:22.959 --> 00:01:27.320 If you look here 20 00:01:27.320 --> 00:01:30.519 First we'll paste it here 21 00:01:30.519 --> 00:01:32.117 The information here 22 00:01:35.830 --> 00:01:39.040 is in the vampire form 23 00:01:39.040 --> 00:01:42.919 I took this from a platform called Mixamo 24 00:01:42.919 --> 00:01:47.959 The Mixamo website is provided by Adobe 25 00:01:47.959 --> 00:01:52.879 If you look here, there are characters and animations 26 00:01:52.879 --> 00:01:55.599 There are enemies here 27 00:01:55.599 --> 00:01:58.400 We're going to use the Vampire 28 00:01:58.400 --> 00:02:02.839 And for animation, we're going to use the animations here 29 00:02:02.839 --> 00:02:06.080 There are many of them here 30 00:02:06.080 --> 00:02:10.399 If you look into it, Mixamo has free license 31 00:02:10.399 --> 00:02:14.000 It's completely open for personal use 32 00:02:14.000 --> 00:02:20.080 So we're going to use this for our example 33 00:02:20.080 --> 00:02:24.399 Like this, the animation is all prepared 34 00:02:24.399 --> 00:02:27.639 Basically, the Idle position 35 00:02:27.639 --> 00:02:30.440 and the Move position for moving 36 00:02:30.440 --> 00:02:32.800 and death processing 37 00:02:32.800 --> 00:02:34.515 There's reaction for being shoot by a gun 38 00:02:34.515 --> 00:02:37.720 We're going to put about two reactions and process it 39 00:02:37.720 --> 00:02:40.240 And the Idle position for attacking 40 00:02:40.240 --> 00:02:43.320 And the attacking position 41 00:02:43.320 --> 00:02:47.800 We're going to use these 7 animations 42 00:02:47.800 --> 00:02:51.800 Let's now apply these 43 00:02:51.800 --> 00:02:58.039 We'll proceed directly on the code 44 00:02:58.039 --> 00:03:03.639 Go to the constructor of Enemy 45 00:03:03.639 --> 00:03:06.080 and we're going to change this part 46 00:03:06.080 --> 00:03:11.720 Right now, it's in Quinn 47 00:03:11.720 --> 00:03:15.720 We'll move our downloaded file into Models 48 00:03:15.720 --> 00:03:22.039 Like this, move it into the Models file 49 00:03:22.039 --> 00:03:26.056 In the Models 50 00:03:26.056 --> 00:03:28.570 This one, select this 51 00:03:28.570 --> 00:03:32.399 Select the Skeletal Mesh and copy it 52 00:03:32.399 --> 00:03:35.000 Click Copy Reference 53 00:03:35.000 --> 00:03:40.399 And here, the path isn't this anymore 54 00:03:40.399 --> 00:03:42.720 We'll change it like this 55 00:03:42.720 --> 00:03:45.960 And we're also going to control the animation as well 56 00:03:45.960 --> 00:03:51.320 Compile first, and let's see if it changes 57 00:03:51.320 --> 00:03:56.360 Go to Enemy, then Mesh 58 00:03:56.360 --> 00:03:58.080 It's not applied right away 59 00:03:58.080 --> 00:04:11.960 Let's close it and open it again 60 00:04:11.960 --> 00:04:15.639 There's an undo button here, and now it changes 61 00:04:15.639 --> 00:04:17.720 Compile it and see 62 00:04:17.720 --> 00:04:21.440 Now you can see that it's changed into a vampire 63 00:04:21.440 --> 00:04:23.320 We're going to add animations to this 64 00:04:23.320 --> 00:04:26.279 Same thing here, create the animation blueprint 65 00:04:26.279 --> 00:04:28.760 and add it here 66 00:04:28.760 --> 00:04:31.480 Then 67 00:04:31.480 --> 00:04:32.880 Let's make one first 68 00:04:32.880 --> 00:04:33.980 Blueprint 69 00:04:33.980 --> 00:04:38.359 Go to Animation, then Animation Blueprint 70 00:04:38.359 --> 00:04:39.239 Like this 71 00:04:39.239 --> 00:04:42.279 Here, the Skeleton is at the very bottom 72 00:04:42.279 --> 00:04:43.519 It says vampire 73 00:04:43.519 --> 00:04:47.160 Select this, and click Create 74 00:04:47.160 --> 00:04:58.079 We'll name it WBP_Enemy 75 00:04:58.079 --> 00:05:01.839 and double-click this 76 00:05:01.839 --> 00:05:03.559 We're going to produce it 77 00:05:03.559 --> 00:05:06.959 Basically, it will be FSM-based 78 00:05:06.959 --> 00:05:10.119 So right-click here 79 00:05:10.119 --> 00:05:14.399 Type state machine, and it's here 80 00:05:14.399 --> 00:05:20.000 We'll name the State Machine "FSM" 81 00:05:20.000 --> 00:05:23.760 And connect it like this 82 00:05:23.760 --> 00:05:25.880 It goes in like this 83 00:05:25.880 --> 00:05:29.000 For our Enemy 84 00:05:29.000 --> 00:05:31.160 if you look at the header of EnemyFSM 85 00:05:31.160 --> 00:05:34.040 there are 5 types of states 86 00:05:34.040 --> 00:05:36.279 The basic ones, IDLE, MOVE, ATTACK 87 00:05:36.279 --> 00:05:39.009 We'll make these three states first 88 00:05:41.959 --> 00:05:43.239 There are animations here 89 00:05:43.239 --> 00:05:45.279 Let's try using them 90 00:05:45.279 --> 00:05:49.920 For the Idle position, we'll use Standing_Idle 91 00:05:49.920 --> 00:05:51.160 Bring it like this 92 00:05:51.160 --> 00:05:55.239 We'll call this "Idle" 93 00:05:55.239 --> 00:05:57.720 For moving, we'll use Run 94 00:05:57.720 --> 00:06:02.600 Like this, and we'll name it "Move" 95 00:06:02.600 --> 00:06:08.440 Then we just need to connect the transitions like this 96 00:06:08.895 --> 00:06:13.835 Let's enlarge it a little 97 00:06:15.241 --> 00:06:16.920 Then we're going to make Attack 98 00:06:16.920 --> 00:06:20.480 For Attack, after attacking 99 00:06:20.480 --> 00:06:23.279 Or, as soon as the animation is initiated 100 00:06:23.279 --> 00:06:25.399 It doesn't attack right at the time of transition 101 00:06:25.399 --> 00:06:27.136 Here, when you take a look at Kick 102 00:06:29.484 --> 00:06:33.679 it's in the form of kicking 103 00:06:33.679 --> 00:06:37.119 So we're first going to use this 104 00:06:37.119 --> 00:06:37.839 But it will be like this 105 00:06:37.839 --> 00:06:39.880 Here, choose Add State 106 00:06:39.880 --> 00:06:42.246 Name it "Attack" 107 00:06:45.651 --> 00:06:49.760 From Attack, we may move back to Move 108 00:06:49.760 --> 00:06:52.200 So we'll make it like this 109 00:06:52.200 --> 00:06:53.679 Then go into Attack 110 00:06:53.679 --> 00:06:56.200 And within Attack, there will be another state 111 00:06:56.200 --> 00:06:58.519 A sub-state will be made 112 00:06:58.519 --> 00:06:59.728 Idle 113 00:07:02.114 --> 00:07:03.176 Move 114 00:07:04.760 --> 00:07:08.440 Then it will attack 115 00:07:08.440 --> 00:07:09.839 The Attack state is 116 00:07:09.839 --> 00:07:13.559 if you look into it in detail again 117 00:07:13.559 --> 00:07:15.559 We're going to make it into this state 118 00:07:15.559 --> 00:07:17.880 We're going to add two more states 119 00:07:17.880 --> 00:07:21.359 conceptually. There's the Attack state 120 00:07:21.359 --> 00:07:23.123 and then there's the Attack Idle 121 00:07:25.440 --> 00:07:27.359 Then after the attack animation 122 00:07:27.359 --> 00:07:29.559 it comes down this way 123 00:07:29.559 --> 00:07:32.839 Once the animation is over, it goes into Idle automatically 124 00:07:32.839 --> 00:07:35.600 Then in order to go into Attack again from Attack Idle 125 00:07:35.600 --> 00:07:38.480 we're going to add a condition 126 00:07:38.480 --> 00:07:42.119 For this, it will be auto 127 00:07:42.119 --> 00:07:45.559 In this form, we're going to fill in this part 128 00:07:45.559 --> 00:07:48.559 We're going to add it here 129 00:07:48.559 --> 00:07:50.760 Then in this condition 130 00:07:50.760 --> 00:07:55.000 something like bAttack 131 00:07:55.000 --> 00:07:56.799 A variable like this will be made 132 00:07:56.799 --> 00:07:58.920 So after it attacks 133 00:07:58.920 --> 00:08:01.239 the basic state is in false 134 00:08:01.239 --> 00:08:05.440 Once it becomes true, it transitions to Attack again 135 00:08:05.440 --> 00:08:10.119 We'll control it in this form 136 00:08:10.119 --> 00:08:12.079 Then come back here 137 00:08:12.079 --> 00:08:14.000 We'll have to make another state here 138 00:08:14.000 --> 00:08:15.600 State Machine 139 00:08:19.480 --> 00:08:31.160 We'll name it AttackSubFSM 140 00:08:31.160 --> 00:08:32.640 Double-click to enter 141 00:08:32.640 --> 00:08:35.159 Here, add attack, and attacking is Kick 142 00:08:35.159 --> 00:08:37.000 We're going to use Kick for attacking 143 00:08:37.000 --> 00:08:41.636 Name it Attack 144 00:08:48.359 --> 00:08:49.799 After Attack 145 00:08:49.799 --> 00:08:52.080 it's going to go into the Idle state automatically 146 00:08:52.080 --> 00:08:54.440 This time, use Unarmed_Idle 147 00:08:54.440 --> 00:08:56.719 We'll assume this position 148 00:08:56.719 --> 00:09:00.080 We'll name this AttackIdle 149 00:09:00.080 --> 00:09:02.640 There may be various positions for standing 150 00:09:02.640 --> 00:09:05.599 So like this 151 00:09:05.599 --> 00:09:07.919 So going from Attack into AttackIdle 152 00:09:07.919 --> 00:09:11.000 will be Automatic 153 00:09:11.000 --> 00:09:13.760 And going back the opposite way 154 00:09:13.760 --> 00:09:15.760 we're going to make a condition 155 00:09:15.760 --> 00:09:18.559 So we're going to add a variable here 156 00:09:18.559 --> 00:09:20.520 We won't add it right away 157 00:09:20.520 --> 00:09:23.239 First save it 158 00:09:23.239 --> 00:09:24.479 There are going to be some errors right now 159 00:09:24.479 --> 00:09:26.520 because we didn't add conditions here 160 00:09:26.520 --> 00:09:30.239 Create an animation blueprint 161 00:09:30.239 --> 00:09:32.159 and make a variable there 162 00:09:32.159 --> 00:09:34.200 That's how we will configurate it 163 00:09:34.200 --> 00:09:35.919 Then come back to here 164 00:09:35.919 --> 00:09:40.159 In Tools, we're going to make a Class 165 00:09:40.159 --> 00:09:44.679 Here, type Animinstance 166 00:09:44.679 --> 00:09:46.320 we're going to produce this 167 00:09:46.320 --> 00:09:48.119 This is for Enemy 168 00:09:48.119 --> 00:09:51.320 Click Next 169 00:09:51.320 --> 00:09:57.520 EnemyAnim 170 00:09:57.520 --> 00:09:59.919 That will be the name 171 00:09:59.919 --> 00:10:02.760 For Player too, it was PlayerAnim 172 00:10:02.760 --> 00:10:04.559 Like this 173 00:10:04.559 --> 00:10:06.719 Similar rules for this as well 174 00:10:06.719 --> 00:10:10.960 Create it like this 175 00:10:10.960 --> 00:10:13.640 Go to the header file of EnemyAnim 176 00:10:13.640 --> 00:10:16.320 We'll add a variable here 177 00:10:16.320 --> 00:10:17.960 The variable we're going to add is 178 00:10:17.960 --> 00:10:20.192 First, put public 179 00:10:23.479 --> 00:10:25.840 Here, we're going to create a state 180 00:10:25.840 --> 00:10:28.359 State. This state actually 181 00:10:28.359 --> 00:10:32.159 is the state here, in the EnemyFSM 182 00:10:32.159 --> 00:10:34.640 Here, we created a variable called State 183 00:10:34.640 --> 00:10:38.760 We're going to use this in EnemyAnim 184 00:10:38.760 --> 00:10:42.559 But since we're going to use it in blueprint 185 00:10:42.559 --> 00:10:46.520 we're going to create a variable here 186 00:10:46.520 --> 00:10:49.032 So over here 187 00:10:49.032 --> 00:10:51.880 Using the same name written in the FSM header 188 00:10:51.880 --> 00:10:56.359 Copy it directly into here 189 00:10:56.359 --> 00:10:57.880 But to use this 190 00:10:57.880 --> 00:11:00.109 the header has to be added 191 00:11:00.109 --> 00:11:02.456 Take the header of EnemyFSM 192 00:11:02.456 --> 00:11:04.758 and add it here 193 00:11:12.066 --> 00:11:16.466 include "EnemyFSM.h" file 194 00:11:19.191 --> 00:11:22.400 Type it like this 195 00:11:22.400 --> 00:11:24.400 Then we can use it 196 00:11:24.400 --> 00:11:27.479 Since we're going to use it in blueprint 197 00:11:27.479 --> 00:11:31.479 put UPROPERTY here 198 00:11:31.479 --> 00:11:33.559 Choose EditAnywhere 199 00:11:33.559 --> 00:11:35.177 And in blueprint 200 00:11:35.177 --> 00:11:38.239 we're going to allow it to be read 201 00:11:38.239 --> 00:11:41.479 We're going to use ReadOnly 202 00:11:41.479 --> 00:11:43.919 Since you're a little more familiar now 203 00:11:43.919 --> 00:11:51.479 instead of EditAnywhere 204 00:11:51.479 --> 00:11:56.000 EditDefaultsOnly will be more correct 205 00:11:56.039 --> 00:11:59.840 Let's change it a little like this 206 00:11:59.840 --> 00:12:02.253 So read this in blueprint 207 00:12:02.253 --> 00:12:04.615 Since it's going to read it, changing this value 208 00:12:04.615 --> 00:12:07.679 will be written in the C code 209 00:12:07.679 --> 00:12:11.559 Then reading it and interpreting it 210 00:12:11.559 --> 00:12:13.520 will be done by blueprint 211 00:12:13.520 --> 00:12:15.640 That's why we set it as ReadOnly 212 00:12:15.640 --> 00:12:17.280 We're going to make another one 213 00:12:17.280 --> 00:12:19.960 We need the concept of bAttack, as mentioned earlier 214 00:12:19.960 --> 00:12:23.159 So use UPROPERTY the same way 215 00:12:23.159 --> 00:12:25.559 Let's copy it 216 00:12:25.559 --> 00:12:27.193 It will be a bool type 217 00:12:27.193 --> 00:12:33.520 and make a variable called bAttack 218 00:12:33.520 --> 00:12:36.320 And this has to be inherited 219 00:12:36.320 --> 00:12:38.320 Save it 220 00:12:38.320 --> 00:12:47.960 Come back to Unreal, and compile it 221 00:12:47.960 --> 00:12:50.260 Go to WBP_Enemy 222 00:12:50.260 --> 00:12:52.200 Save it first 223 00:12:52.200 --> 00:12:54.100 Then in Class Settings 224 00:12:54.100 --> 00:12:55.200 let's change it 225 00:12:55.200 --> 00:12:58.900 Type EnemyAnim 226 00:12:58.900 --> 00:12:59.760 It's here 227 00:12:59.760 --> 00:13:02.880 We'll change it like this 228 00:13:02.880 --> 00:13:06.028 Then in the parent class 229 00:13:06.028 --> 00:13:07.200 there's a variable 230 00:13:07.200 --> 00:13:08.840 So we can use it here 231 00:13:08.840 --> 00:13:11.000 To see it, it's not appearing right now 232 00:13:11.000 --> 00:13:13.760 To see it, click the gear wheel 233 00:13:13.760 --> 00:13:17.039 There's something called Show Inherited Variables 234 00:13:17.039 --> 00:13:20.039 It means whether you want to see the inherited variables 235 00:13:20.039 --> 00:13:21.599 Check this off 236 00:13:21.599 --> 00:13:24.320 For the parent, there's Enemy Anim 237 00:13:24.320 --> 00:13:27.239 Here, the State and Attack are shown 238 00:13:27.239 --> 00:13:29.679 You can see it like this 239 00:13:29.679 --> 00:13:32.039 Then using these variables 240 00:13:32.039 --> 00:13:34.880 we're going to fill in all the conditions 241 00:13:34.880 --> 00:13:38.719 The condition of going from AttackIdle back into Attack 242 00:13:38.719 --> 00:13:41.280 If Attack is true 243 00:13:41.280 --> 00:13:44.372 then it can go back like this 244 00:13:44.372 --> 00:13:48.159 That's how we'll assign it 245 00:13:48.159 --> 00:13:50.799 Then these two conditions are satisfied 246 00:13:50.799 --> 00:13:52.559 Let's go back 247 00:13:52.559 --> 00:13:54.200 Go to the FSM part 248 00:13:54.200 --> 00:13:56.799 Now we need to fill in these three conditions 249 00:13:56.799 --> 00:13:59.559 Going from Idle to Move 250 00:13:59.559 --> 00:14:02.559 Double-click on it, and use the State here 251 00:14:02.559 --> 00:14:05.559 If the State is Equal 252 00:14:05.559 --> 00:14:09.840 Type == and there's Equal (Enum) 253 00:14:09.840 --> 00:14:12.840 Use Equal (Enum) 254 00:14:12.840 --> 00:14:17.960 Once the state becomes Move 255 00:14:17.960 --> 00:14:20.359 Right? Because it goes from Idle to Move 256 00:14:20.359 --> 00:14:23.960 If the state has changed into Move 257 00:14:23.960 --> 00:14:28.559 Then true 258 00:14:28.559 --> 00:14:31.559 We're create a condition to transition it 259 00:14:31.559 --> 00:14:33.640 Then the condition looks like this 260 00:14:33.640 --> 00:14:37.159 If State and Move are equal, then transition 261 00:14:37.159 --> 00:14:38.239 That's what it means 262 00:14:38.239 --> 00:14:40.089 For these two as well 263 00:14:40.089 --> 00:14:41.919 let's make it too 264 00:14:41.919 --> 00:14:43.679 Going from Move to Attack 265 00:14:43.679 --> 00:14:44.829 and going from Attack to Move 266 00:14:44.829 --> 00:14:46.919 We'll use this rule as well 267 00:14:46.919 --> 00:14:48.460 For Move to Attack 268 00:14:48.460 --> 00:14:51.559 Same thing here, use State 269 00:14:51.559 --> 00:14:54.840 Type == on State 270 00:14:54.840 --> 00:14:56.960 Select the one that says Enum 271 00:14:56.960 --> 00:14:59.599 Then this is going into Attack 272 00:14:59.599 --> 00:15:03.119 So change this into ATTACK 273 00:15:03.119 --> 00:15:04.799 We'll connect it like this 274 00:15:04.799 --> 00:15:06.000 Since we're going to use the same method 275 00:15:06.000 --> 00:15:07.320 let's copy this 276 00:15:07.320 --> 00:15:12.640 Then for Attack to Move 277 00:15:12.640 --> 00:15:14.599 This will now be MOVE 278 00:15:14.599 --> 00:15:16.549 If it became Move 279 00:15:16.549 --> 00:15:20.200 transition from Attack to Move 280 00:15:20.200 --> 00:15:23.320 We can make rules like this 281 00:15:23.320 --> 00:15:26.359 If needed, we can also connect like this 282 00:15:26.359 --> 00:15:29.640 Same thing here, add it here 283 00:15:29.640 --> 00:15:31.000 This is now IDLE 284 00:15:31.000 --> 00:15:33.919 If the state is Idle, then transition 285 00:15:33.919 --> 00:15:36.960 Assign it like this 286 00:15:36.960 --> 00:15:39.599 All the conditions have been made and the possible transitions 287 00:15:39.599 --> 00:15:41.440 have been configured 288 00:15:41.440 --> 00:15:43.599 Let's preview this 289 00:15:43.599 --> 00:15:46.092 First, there's the Idle position 290 00:15:49.320 --> 00:15:52.960 Select MOVE, and now it walks 291 00:15:52.960 --> 00:15:56.080 But wait, the animation doesn't repeat 292 00:15:56.080 --> 00:15:58.840 We'll first have to repeat all of them 293 00:15:58.840 --> 00:16:07.159 Check off Loop Animation for all of them 294 00:16:07.159 --> 00:16:10.520 Even for those in Attack 295 00:16:10.640 --> 00:16:14.119 We'll repeat Kick as well 296 00:16:14.119 --> 00:16:16.599 We'll repeat AttackIdle for now as well 297 00:16:16.599 --> 00:16:18.760 Check off Loop for all of them 298 00:16:18.760 --> 00:16:22.039 Let's see the results again 299 00:16:22.039 --> 00:16:25.159 For IDLE, it will be like this 300 00:16:25.159 --> 00:16:28.119 Select MOVE, and it will walk 301 00:16:28.119 --> 00:16:30.000 Walk, then ATTACK 302 00:16:30.000 --> 00:16:34.000 Then it kicks, then goes back to idle 303 00:16:34.000 --> 00:16:38.760 But I think I assigned Idle positions the opposite way 304 00:16:38.760 --> 00:16:42.559 I switched up Unarmed_Idle and Standing_Idle 305 00:16:42.559 --> 00:16:44.200 We'll switch it 306 00:16:44.200 --> 00:16:49.119 Change Standing_Idle into Unarmed_Idle 307 00:16:49.119 --> 00:16:52.080 I made a little mistake here 308 00:16:52.080 --> 00:16:53.039 I'll do it again 309 00:16:53.039 --> 00:16:58.200 Select Loop Animation 310 00:16:58.200 --> 00:17:00.559 For AttackIdle, not this but 311 00:17:00.559 --> 00:17:07.400 change it to Standing_Idle 312 00:17:07.400 --> 00:17:10.319 Let's try it again 313 00:17:10.319 --> 00:17:11.680 Preview again 314 00:17:11.680 --> 00:17:14.119 IDLE is this position 315 00:17:14.119 --> 00:17:16.160 Then MOVE is walking 316 00:17:16.160 --> 00:17:17.760 Then for ATTACK 317 00:17:17.760 --> 00:17:19.901 It attacks, and then 318 00:17:19.901 --> 00:17:22.119 I wanted it to go into a threatening Idle position 319 00:17:22.119 --> 00:17:23.479 So I did it again like this 320 00:17:23.479 --> 00:17:25.439 Then in order to attack 321 00:17:25.439 --> 00:17:27.439 there's a variable called Attack 322 00:17:27.439 --> 00:17:30.199 If you check this off, it attacks 323 00:17:30.199 --> 00:17:33.280 It attacks repeatedly if this is checked 324 00:17:33.280 --> 00:17:34.599 If this is not checked, it attacks once 325 00:17:34.599 --> 00:17:37.599 It goes back to Idle 326 00:17:37.599 --> 00:17:41.760 If you look here, if I check it off then uncheck it again 327 00:17:41.760 --> 00:17:42.920 It stays still 328 00:17:42.920 --> 00:17:45.020 And if this is true, it attacks 329 00:17:45.020 --> 00:17:47.160 If unchecked, it stays still 330 00:17:47.160 --> 00:17:50.119 After making it work like this 331 00:17:50.119 --> 00:17:53.280 control these variables in the code 332 00:17:53.280 --> 00:17:55.527 then the forms of animation that we want 333 00:17:55.527 --> 00:17:57.095 can be configured 334 00:17:59.920 --> 00:18:03.719 Then first, save it like this 335 00:18:03.719 --> 00:18:05.693 Let's implement it 336 00:18:09.000 --> 00:18:12.839 Go to the source file of EnemyFSM 337 00:18:12.839 --> 00:18:15.199 We're going to control it here 338 00:18:15.199 --> 00:18:20.160 But in EnemyFSM 339 00:18:20.160 --> 00:18:23.239 I think we should change the variable in EnemyAnim 340 00:18:23.239 --> 00:18:24.600 In EnemyAnim, we 341 00:18:24.600 --> 00:18:26.119 made two here 342 00:18:26.119 --> 00:18:28.119 Changing these 343 00:18:28.119 --> 00:18:31.400 should be done in EnemyFSM 344 00:18:31.400 --> 00:18:34.479 Then we should bring it from here 345 00:18:34.479 --> 00:18:36.486 now that I think about it. Then in the header 346 00:18:36.486 --> 00:18:38.800 Go to the header of EnemyFSM 347 00:18:38.800 --> 00:18:41.280 We'll make that variable and control it 348 00:18:41.280 --> 00:18:47.520 Then under Me, write UPROPERTY once again 349 00:18:47.520 --> 00:18:56.560 class UEnemyAnim 350 00:18:56.560 --> 00:18:58.880 Set it as a pointer 351 00:18:58.880 --> 00:19:02.479 This will be EnemyAnim 352 00:19:02.479 --> 00:19:03.719 Then this has to be filled in 353 00:19:03.719 --> 00:19:06.719 We can bring this in from Me 354 00:19:06.719 --> 00:19:12.400 Then animation blueprint 355 00:19:12.400 --> 00:19:14.751 has to be brought over, now that I think about it 356 00:19:14.751 --> 00:19:18.256 Then let's go to Enemy. Go to Enemy 357 00:19:18.256 --> 00:19:21.119 I have EnemyAnim here 358 00:19:21.119 --> 00:19:23.880 then use that here 359 00:19:23.880 --> 00:19:25.880 We'll approach it that way 360 00:19:25.880 --> 00:19:30.719 Here, type UPROPERTY 361 00:19:30.719 --> 00:19:32.359 Let's do it like this for now 362 00:19:32.359 --> 00:19:33.719 Let's just put this in for now 363 00:19:33.719 --> 00:19:37.000 EditAnywhere 364 00:19:37.000 --> 00:19:39.280 Put class 365 00:19:39.280 --> 00:19:46.359 We'll put UEnemyAnim 366 00:19:46.359 --> 00:19:49.319 Then this has to be loaded and added 367 00:19:49.319 --> 00:19:51.920 Normally, factory is made 368 00:19:51.920 --> 00:19:53.070 After reading it 369 00:19:53.070 --> 00:19:55.760 then it has to be assigned 370 00:19:55.760 --> 00:19:57.510 But instead of doing that this time 371 00:19:57.510 --> 00:19:59.560 we'll load it right on here 372 00:19:59.560 --> 00:20:01.319 Go to the header file 373 00:20:01.319 --> 00:20:05.680 Here, under this 374 00:20:05.680 --> 00:20:08.800 Should we do it here, right above FSM 375 00:20:08.800 --> 00:20:13.760 We'll load this and fill it in 376 00:20:13.760 --> 00:20:18.719 Then in ConstructorHelpers::F 377 00:20:18.719 --> 00:20:21.800 EnemyAnim is actually in a blueprint 378 00:20:21.800 --> 00:20:23.400 So this time, instead of Object 379 00:20:23.400 --> 00:20:25.250 using ClassFinder 380 00:20:25.250 --> 00:20:29.959 we'll read it in 381 00:20:29.959 --> 00:20:34.680 What it will read is UEnemyAnim 382 00:20:34.680 --> 00:20:36.319 It's going to read like this 383 00:20:36.319 --> 00:20:44.000 Should we do TempAnim 384 00:20:44.000 --> 00:20:45.260 Put TEXT 385 00:20:45.260 --> 00:20:46.316 The path here 386 00:20:46.316 --> 00:20:48.479 can be added as well 387 00:20:48.479 --> 00:20:50.199 We'll have to find the path then 388 00:20:50.199 --> 00:20:52.280 Go here 389 00:20:52.280 --> 00:20:55.040 What we're going to read is this 390 00:20:55.040 --> 00:20:57.000 WBP_Enemy 391 00:20:57.000 --> 00:20:58.499 If you look here 392 00:20:58.499 --> 00:21:00.640 you can also do Copy Reference here 393 00:21:00.640 --> 00:21:02.959 Bring it in 394 00:21:02.959 --> 00:21:05.628 Then write it here 395 00:21:08.340 --> 00:21:09.697 Then for this 396 00:21:09.697 --> 00:21:11.719 we'll have to see if loading succeeded 397 00:21:11.719 --> 00:21:20.000 If load was successful 398 00:21:20.000 --> 00:21:28.359 In GetMesh, there's SetAnimInstanceClass 399 00:21:28.359 --> 00:21:31.309 Here, the loaded TempAnim.Class 400 00:21:31.309 --> 00:21:33.920 can be inserted like this 401 00:21:33.920 --> 00:21:35.479 This is Class 402 00:21:35.479 --> 00:21:37.179 We found Class using the Finder 403 00:21:37.179 --> 00:21:39.280 That's why we added Class 404 00:21:39.280 --> 00:21:42.719 There's no Object here at all, right? 405 00:21:42.719 --> 00:21:44.319 Add Class 406 00:21:44.319 --> 00:21:45.989 And when putting this in 407 00:21:45.989 --> 00:21:48.640 for loading, the path is like this 408 00:21:48.640 --> 00:21:52.140 At the end, put _C 409 00:21:52.140 --> 00:21:55.079 in order for it to load properly 410 00:21:55.079 --> 00:21:56.959 Then now this is going to be filled in 411 00:21:56.959 --> 00:21:58.739 To fill in EnemyAnim 412 00:21:58.739 --> 00:22:01.520 this isn't done within Constructor 413 00:22:01.520 --> 00:22:07.199 It has to be filled in on BeginPlay 414 00:22:07.199 --> 00:22:11.599 Then the configuration will be like this 415 00:22:11.599 --> 00:22:13.879 For filling this in 416 00:22:13.879 --> 00:22:16.280 bring in AnimInstance again from GetMesh 417 00:22:16.280 --> 00:22:22.540 In GetMesh, GetAnimInstance 418 00:22:22.540 --> 00:22:24.640 Bring it in like this 419 00:22:24.640 --> 00:22:26.839 For this, the data type is a little different 420 00:22:26.839 --> 00:22:28.739 For AnimInstance 421 00:22:28.739 --> 00:22:32.119 UAnimInstance is returned 422 00:22:32.119 --> 00:22:34.359 This can be used by casting 423 00:22:34.359 --> 00:22:35.800 Put Cast 424 00:22:35.800 --> 00:22:40.950 Like this, UEnemyAnim 425 00:22:40.950 --> 00:22:44.920 You can use it by casting, like this 426 00:22:44.920 --> 00:22:47.800 Then we'll add the header first 427 00:22:47.800 --> 00:22:49.719 Add the header like this 428 00:22:49.719 --> 00:22:55.520 On top, the Anim header was added 429 00:22:55.520 --> 00:22:59.160 And now that we've configured everything 430 00:22:59.160 --> 00:23:02.959 we can use it in FSM 431 00:23:02.959 --> 00:23:08.009 Then in FSM, go to BeginPlay 432 00:23:08.009 --> 00:23:10.040 Let's fill in EnemyAnim first 433 00:23:10.040 --> 00:23:14.599 In Me, fill it in like this 434 00:23:14.599 --> 00:23:16.199 Let's compile it 435 00:23:16.199 --> 00:23:18.239 Turn off Unreal for now 436 00:23:18.239 --> 00:23:25.079 Let's build again 437 00:23:25.079 --> 00:23:32.680 And execute it again 438 00:23:32.680 --> 00:23:39.400 Using this, we're going to configure 439 00:23:39.400 --> 00:23:42.920 Let's look at the attack motion of the Enemy 440 00:23:42.920 --> 00:23:52.560 If you look here, the attack motion is in here 441 00:23:52.560 --> 00:23:54.599 Then if the attack motion is like this 442 00:23:54.599 --> 00:23:58.040 then the actual time of hitting will be Hit 443 00:23:58.040 --> 00:24:00.599 This part has to be the Hit 444 00:24:00.599 --> 00:24:03.040 And when the animation is over 445 00:24:03.040 --> 00:24:05.920 we'll have to know it 446 00:24:05.920 --> 00:24:09.479 So for these two instances, the time of Hit 447 00:24:09.479 --> 00:24:11.520 and the time of animation ending 448 00:24:11.520 --> 00:24:13.760 We want to know these two times 449 00:24:13.760 --> 00:24:15.920 So rather than measuring the time 450 00:24:15.920 --> 00:24:19.680 we can add Event here and find out 451 00:24:19.680 --> 00:24:21.439 It will be around here 452 00:24:21.439 --> 00:24:24.160 This is the actual time of hitting 453 00:24:24.160 --> 00:24:28.199 When the animation is played, it doesn't Hit right away 454 00:24:28.199 --> 00:24:29.359 This is when it Hits 455 00:24:29.359 --> 00:24:31.359 Then the motion is over 456 00:24:31.359 --> 00:24:33.640 This is what we want to know 457 00:24:33.640 --> 00:24:38.000 So at around here, we're going to add Event 458 00:24:38.000 --> 00:24:39.640 It says Notifies here 459 00:24:39.640 --> 00:24:42.079 Where it says 1, follow along to the right 460 00:24:42.079 --> 00:24:44.439 Here, right-click on it 461 00:24:44.439 --> 00:24:46.160 We can do Add Notify 462 00:24:46.160 --> 00:24:49.760 Here, select New Notify, and name it Hit 463 00:24:49.760 --> 00:24:52.680 We can write it like this 464 00:24:52.680 --> 00:24:55.400 And around when it ends, right about here 465 00:24:55.400 --> 00:24:57.920 We'll add another one here 466 00:24:57.920 --> 00:25:00.400 We'll name it AttackEnd 467 00:25:00.400 --> 00:25:03.540 It already says it here 468 00:25:03.540 --> 00:25:08.239 We added Notify 469 00:25:08.239 --> 00:25:11.239 Then, after adding Notify 470 00:25:11.239 --> 00:25:14.280 the way we can know this, is that 471 00:25:14.280 --> 00:25:17.719 this corresponding animation sequence 472 00:25:17.719 --> 00:25:19.479 is owned by an animation blueprint 473 00:25:19.479 --> 00:25:21.520 In EventGraph 474 00:25:21.520 --> 00:25:22.719 we can find that out 475 00:25:22.719 --> 00:25:27.560 Here, it was Hit right? 476 00:25:27.560 --> 00:25:29.800 Type hit 477 00:25:29.800 --> 00:25:31.439 There's something called Event 478 00:25:31.439 --> 00:25:35.319 AnimNotify_Hit 479 00:25:35.319 --> 00:25:37.000 And there was another one 480 00:25:37.000 --> 00:25:39.359 We also had AttackEnd 481 00:25:39.359 --> 00:25:45.479 We'll add AttackEnd as well 482 00:25:45.479 --> 00:25:50.319 We can be notified this way 483 00:25:50.319 --> 00:25:52.439 Then if we get notified here 484 00:25:52.439 --> 00:25:57.040 we need to send the signal to Enemy 485 00:25:57.079 --> 00:25:59.880 So we'll create that structure 486 00:25:59.880 --> 00:26:04.079 If you see here, you're getting notified from here 487 00:26:04.079 --> 00:26:06.079 Then if you're notified from here 488 00:26:06.079 --> 00:26:07.359 it was received from the blueprint part 489 00:26:07.359 --> 00:26:10.479 Then it should be called again 490 00:26:10.479 --> 00:26:13.239 in the C code part 491 00:26:13.239 --> 00:26:17.359 Then here, put UFUNCTION 492 00:26:17.359 --> 00:26:22.680 put void, then let's make a function called OnHit 493 00:26:22.680 --> 00:26:24.850 And using the same name 494 00:26:24.850 --> 00:26:29.000 Not name, using the same structure, put OnAttackEnd 495 00:26:29.000 --> 00:26:30.280 Make it like this 496 00:26:30.280 --> 00:26:32.599 And for this, we're going to make a function 497 00:26:32.599 --> 00:26:34.439 that can be called from the blueprint part 498 00:26:34.439 --> 00:26:36.280 So in UFUNCTION 499 00:26:36.280 --> 00:26:43.479 there's a specifier called BlueprintCallable 500 00:26:43.479 --> 00:26:46.160 We'll put this in 501 00:26:46.160 --> 00:26:48.479 Like this 502 00:26:48.479 --> 00:26:51.319 Create the implementation like this 503 00:26:51.319 --> 00:26:55.239 And this action is actually 504 00:26:55.239 --> 00:26:56.280 not done here 505 00:26:56.280 --> 00:26:57.959 But it should be done in FSM 506 00:26:57.959 --> 00:27:01.560 So in FSM, make it with the same name 507 00:27:01.560 --> 00:27:04.479 So when it's called from Anim 508 00:27:04.479 --> 00:27:06.800 the function in FSM will be called 509 00:27:06.800 --> 00:27:08.520 We'll configure it like that 510 00:27:08.520 --> 00:27:09.680 Go to header 511 00:27:09.680 --> 00:27:13.599 We'll write it right under here 512 00:27:13.599 --> 00:27:15.959 We don't need UFUNCTION here 513 00:27:15.959 --> 00:27:23.509 Make the implementation like this 514 00:27:23.509 --> 00:27:29.640 Like this 515 00:27:29.640 --> 00:27:32.319 Save all of this 516 00:27:32.319 --> 00:27:34.119 And now this has to be implemented 517 00:27:34.119 --> 00:27:37.599 We'll do our implemented part in Anim first 518 00:27:37.599 --> 00:27:48.880 Here, we want to call FSM's OnHit 519 00:27:48.880 --> 00:27:49.719 Same thing for this 520 00:27:49.719 --> 00:27:52.319 Same method for the bottom one as well 521 00:27:52.319 --> 00:27:53.839 Here, we want to call this 522 00:27:53.839 --> 00:27:55.640 This is how we're going to configure it 523 00:27:55.640 --> 00:27:59.040 Then here, there's this thing 524 00:27:59.040 --> 00:28:02.160 There's TryGetPawnOwner 525 00:28:02.160 --> 00:28:03.400 We can bring the Owner 526 00:28:03.400 --> 00:28:06.000 The Owner here is the Enemy 527 00:28:06.000 --> 00:28:09.319 So bring the Enemy 528 00:28:09.319 --> 00:28:12.040 and we'll call what's inside FSM 529 00:28:12.040 --> 00:28:15.040 Then we'll have to Cast first 530 00:28:15.040 --> 00:28:18.240 Cast AEnemy, like this 531 00:28:18.240 --> 00:28:22.959 We'll cast to use 532 00:28:22.959 --> 00:28:26.560 We'll put auto enemy 533 00:28:26.560 --> 00:28:30.560 Then if this is not null 534 00:28:30.560 --> 00:28:33.439 Then in enemy 535 00:28:33.439 --> 00:28:37.079 This is a pointer, so we'll put this 536 00:28:37.079 --> 00:28:41.280 In enemy, the FSM 537 00:28:41.280 --> 00:28:42.920 Actually, we need to check null for this as well 538 00:28:42.920 --> 00:28:45.250 So like this, && 539 00:28:45.250 --> 00:28:48.160 Doing this would be more safe 540 00:28:48.160 --> 00:28:50.479 We need to add it to the header to use it 541 00:28:50.479 --> 00:28:54.959 This FSM has to be added to headers as well 542 00:28:54.959 --> 00:28:57.909 In here, OnHit 543 00:28:57.909 --> 00:29:00.079 It means that it's calling it 544 00:29:00.079 --> 00:29:02.439 To use this 545 00:29:02.439 --> 00:29:06.119 FSM has to be added to headers as well 546 00:29:06.119 --> 00:29:10.199 We'll call it here using the same way 547 00:29:10.199 --> 00:29:15.959 Here, it's OnAttackEnd 548 00:29:15.959 --> 00:29:18.719 So when neither are null 549 00:29:18.719 --> 00:29:24.319 we can call 550 00:29:24.319 --> 00:29:26.319 Then taking this structure 551 00:29:26.719 --> 00:29:30.359 we'll finish implementing in FSM 552 00:29:30.359 --> 00:29:31.659 Go to the source file 553 00:29:31.659 --> 00:29:34.439 These are the actions during attacking 554 00:29:34.439 --> 00:29:36.239 The things we did 555 00:29:36.239 --> 00:29:40.280 So these are all for attack 556 00:29:40.280 --> 00:29:43.180 Actually before doing this, we 557 00:29:43.180 --> 00:29:47.199 create a variable for attack 558 00:29:47.199 --> 00:29:49.079 We created a variable called bAttack 559 00:29:49.079 --> 00:29:51.359 Making this true and then false 560 00:29:51.359 --> 00:29:52.719 This is what we need to do 561 00:29:52.719 --> 00:29:58.000 So at the time of Attack, make it true 562 00:29:58.000 --> 00:30:01.900 Then in EnemyAnim 563 00:30:01.900 --> 00:30:06.040 bAttack becomes true 564 00:30:06.040 --> 00:30:07.920 And to use this 565 00:30:07.920 --> 00:30:10.160 of course, the header has to be added 566 00:30:10.160 --> 00:30:13.010 EnemyAnim, on top 567 00:30:13.010 --> 00:30:14.800 Let's add it like this 568 00:30:20.000 --> 00:30:24.760 And for the implementation that we made 569 00:30:24.760 --> 00:30:27.680 Once Attack is over 570 00:30:27.680 --> 00:30:31.319 Attack will become false 571 00:30:31.319 --> 00:30:33.599 Then it can go into Attack again 572 00:30:33.599 --> 00:30:35.079 But there's something to do here 573 00:30:35.079 --> 00:30:41.779 Once the Attack motion is over 574 00:30:41.779 --> 00:30:43.680 we need to decide something 575 00:30:43.680 --> 00:30:47.670 So if the target 576 00:30:47.670 --> 00:30:54.359 If the target is within the attackable distance, do this 577 00:30:54.359 --> 00:31:00.239 Attempt Attack once again 578 00:31:00.239 --> 00:31:07.760 If not, transition to the Move state 579 00:31:07.760 --> 00:31:09.680 It needs this structure 580 00:31:09.680 --> 00:31:12.599 Something to check in OnHit as well 581 00:31:12.599 --> 00:31:13.880 Let's say it extended its leg 582 00:31:13.880 --> 00:31:17.470 but for this instance as well 583 00:31:17.470 --> 00:31:21.479 we need to check if it's within the attackable distance 584 00:31:21.479 --> 00:31:23.640 If so, it attacks 585 00:31:23.640 --> 00:31:24.800 If it is, attack 586 00:31:24.800 --> 00:31:25.680 If not 587 00:31:25.680 --> 00:31:27.640 If not, do nothing 588 00:31:27.640 --> 00:31:30.079 Or else it will kick at the air 589 00:31:30.079 --> 00:31:34.760 We'll add these kinds of conditions 590 00:31:34.760 --> 00:31:38.010 Then the existing contents of Attack 591 00:31:38.010 --> 00:31:39.880 will have to be edited a little 592 00:31:39.880 --> 00:31:43.930 Here, if time passes the attack delay time 593 00:31:43.930 --> 00:31:46.040 then attack. These are what we did 594 00:31:46.040 --> 00:31:48.439 Actually, these are not needed anymore 595 00:31:48.439 --> 00:31:52.800 All of these are not needed, actually 596 00:31:52.800 --> 00:31:56.040 We can control it through Event 597 00:31:56.040 --> 00:31:58.070 Here, since we don't have those 598 00:31:58.070 --> 00:32:01.040 we processed it by measuring time, but 599 00:32:01.040 --> 00:32:03.590 here, we're going to measure the distance from the target 600 00:32:03.590 --> 00:32:05.119 This part has to be done 601 00:32:05.119 --> 00:32:07.560 Copy this and bring it 602 00:32:07.560 --> 00:32:10.640 Here 603 00:32:10.640 --> 00:32:12.479 It will be around here 604 00:32:12.479 --> 00:32:16.400 When the attack motion is over 605 00:32:20.160 --> 00:32:21.719 I added comments but 606 00:32:21.719 --> 00:32:23.439 It's this 607 00:32:23.439 --> 00:32:25.599 This has to be checked here 608 00:32:25.599 --> 00:32:32.239 So if the distance is less than the attack range 609 00:32:32.280 --> 00:32:34.920 Like this, less than 610 00:32:34.920 --> 00:32:37.439 Let's do less than or equal to 611 00:32:37.439 --> 00:32:39.199 Get it 612 00:32:39.199 --> 00:32:40.719 It's this 613 00:32:40.719 --> 00:32:42.280 It will be like this 614 00:32:42.280 --> 00:32:46.479 So here, do this 615 00:32:46.479 --> 00:32:47.599 If not 616 00:32:47.599 --> 00:32:48.400 And that's else 617 00:32:48.400 --> 00:32:52.119 So it's outside the attack range 618 00:32:52.119 --> 00:32:55.160 Then transition to the Move state 619 00:32:55.160 --> 00:32:59.319 What I wrote, is this 620 00:32:59.319 --> 00:33:01.220 I wrote it as is 621 00:33:06.160 --> 00:33:08.010 The attack motion ending means 622 00:33:08.010 --> 00:33:09.920 that this function has been called 623 00:33:09.920 --> 00:33:12.199 Get the distance from the target 624 00:33:12.199 --> 00:33:14.520 and if it's within the attack range 625 00:33:14.520 --> 00:33:16.760 then attempt attack again 626 00:33:16.760 --> 00:33:19.839 If not, transition 627 00:33:19.839 --> 00:33:21.479 And it should be done for this as well 628 00:33:21.479 --> 00:33:24.640 Should we copy it 629 00:33:24.640 --> 00:33:28.160 Like this 630 00:33:28.160 --> 00:33:30.239 Get the distance from the target 631 00:33:30.239 --> 00:33:35.520 If it's within the attack range, attempt attack 632 00:33:35.520 --> 00:33:38.520 Here, it's not this, but it's Hit 633 00:33:38.520 --> 00:33:41.210 The log that we outputted up here 634 00:33:41.210 --> 00:33:42.940 will be outputted here 635 00:33:49.720 --> 00:33:51.980 We'll switch it like this 636 00:33:57.520 --> 00:33:59.400 Then the function that we made 637 00:33:59.400 --> 00:34:00.719 should be callable from there 638 00:34:00.719 --> 00:34:03.619 The two functions that we made in Anim 639 00:34:03.619 --> 00:34:05.959 needs to be called from the blueprint side 640 00:34:05.959 --> 00:34:08.520 Compile first 641 00:34:15.040 --> 00:34:19.600 Here, there's On Hit 642 00:34:19.600 --> 00:34:20.919 Call it 643 00:34:20.919 --> 00:34:24.369 For this, On Attack End 644 00:34:24.369 --> 00:34:26.520 They can be called like this 645 00:34:33.000 --> 00:34:35.119 Let's execute it 646 00:34:38.399 --> 00:34:39.840 There's an error 647 00:34:39.840 --> 00:34:45.439 There was an error in line 95 648 00:34:45.439 --> 00:34:47.679 It will be good to take a look at these 649 00:34:47.679 --> 00:34:54.879 If it's line 95, it's here 650 00:34:54.879 --> 00:34:58.120 We'll have to check if the Enemy exists 651 00:34:58.120 --> 00:35:00.360 Let's try run-time debugging 652 00:35:00.360 --> 00:35:05.080 Press F9, then F5 653 00:35:05.080 --> 00:35:08.039 Then we can do run-time debugging on this 654 00:35:10.639 --> 00:35:12.679 Then let's take a look at this first 655 00:35:12.679 --> 00:35:17.719 Errors can occur easily like this 656 00:35:17.719 --> 00:35:23.239 Let's check it again from here 657 00:35:23.239 --> 00:35:25.800 When we execute it, it gets stuck here 658 00:35:25.800 --> 00:35:28.800 Now that I see it 659 00:35:28.800 --> 00:35:32.159 My EnemyAnim isn't filled in 660 00:35:32.159 --> 00:35:35.600 Then I'll change it a little 661 00:35:35.600 --> 00:35:39.479 Here, let's bring it ourselves 662 00:35:39.479 --> 00:35:42.040 Normally, our Enemy 663 00:35:42.040 --> 00:35:45.800 It was normally filled in on BeginPlay of Enemy 664 00:35:45.800 --> 00:35:49.959 Let's do this here right away 665 00:35:49.959 --> 00:35:54.659 It will be GetMesh of Me 666 00:35:54.659 --> 00:35:56.900 Let's fill it right away 667 00:36:05.840 --> 00:36:11.080 Do this 668 00:36:11.080 --> 00:36:12.800 Ah now it's filled in 669 00:36:12.800 --> 00:36:18.280 Let's proceed this way for now 670 00:36:18.280 --> 00:36:22.020 If you see here, the Enemy exists. The Anim 671 00:36:22.020 --> 00:36:24.919 And we'll change this 672 00:36:24.919 --> 00:36:27.639 But seeing how it's not being applied on animation 673 00:36:27.639 --> 00:36:31.299 I think there's more we need to look at 674 00:36:37.239 --> 00:36:40.879 In the Idle position 675 00:36:40.879 --> 00:36:42.520 Let's take a look slowly 676 00:36:42.520 --> 00:36:46.159 Go to Enemy blueprint 677 00:36:46.199 --> 00:36:52.080 IDLE, then MOVE, then ATTACK 678 00:36:52.080 --> 00:36:55.280 There's no problem here 679 00:36:55.280 --> 00:36:59.679 If you see here, there are signals going in during the attack 680 00:36:59.679 --> 00:37:02.379 There's no problem here 681 00:37:02.379 --> 00:37:05.020 so I think there's a problem in the flow here 682 00:37:06.040 --> 00:37:07.439 Now that I think about it 683 00:37:07.439 --> 00:37:12.360 Did we change the State of EnemyAnim? 684 00:37:12.360 --> 00:37:15.919 In State.. ah this was not done 685 00:37:17.290 --> 00:37:20.199 Here, we only changed the state of FSM 686 00:37:20.199 --> 00:37:25.120 And for the Enemy's State 687 00:37:25.120 --> 00:37:28.300 in the animation part of the Enemy 688 00:37:28.300 --> 00:37:29.800 we created a State 689 00:37:29.800 --> 00:37:32.000 but we didn't fill in the values here 690 00:37:32.000 --> 00:37:35.040 So I think that's why it's not performing the motion 691 00:37:35.040 --> 00:37:39.199 So let's fill it in here 692 00:37:39.199 --> 00:37:42.919 EnemyAnim's State 693 00:37:42.919 --> 00:37:44.719 like this, newState 694 00:37:44.719 --> 00:37:48.120 We'll change it like this 695 00:37:48.120 --> 00:37:52.239 Here, yes 696 00:37:52.239 --> 00:37:56.239 Execute debug mode again 697 00:37:56.239 --> 00:37:59.919 Let's look at the execution results after building it 698 00:38:09.239 --> 00:38:11.919 Execute it, and now it's reacting 699 00:38:11.919 --> 00:38:14.320 It attacks 700 00:38:14.320 --> 00:38:18.159 And it approaches like this 701 00:38:18.159 --> 00:38:21.239 But that guy is not looking at me 702 00:38:21.239 --> 00:38:28.639 For that, go to Enemy 703 00:38:28.639 --> 00:38:32.879 In Character Movement, we 704 00:38:32.879 --> 00:38:34.479 didn't check this 705 00:38:34.479 --> 00:38:37.479 Orient Rotation to Movement 706 00:38:37.479 --> 00:38:40.720 Check this off, and in the direction of its movement 707 00:38:40.720 --> 00:38:42.860 it rotates and comes 708 00:38:42.860 --> 00:38:44.479 This wasn't checked off 709 00:38:44.479 --> 00:38:49.120 After checking it, let's apply it again 710 00:38:49.120 --> 00:38:53.520 Like this, when it moves, as well as when it attacks 711 00:38:53.520 --> 00:38:56.920 it rotates its body when it approaches me 712 00:38:59.026 --> 00:39:02.226 Attack and Death Animation Sequence Configuration 713 00:39:02.840 --> 00:39:05.439 Then now, we're going to shoot with our gun 714 00:39:05.439 --> 00:39:07.040 to process action on that guy 715 00:39:07.040 --> 00:39:08.280 We're going to give Damage 716 00:39:08.280 --> 00:39:10.479 And when it receives Damage 717 00:39:10.479 --> 00:39:12.399 it will fall 718 00:39:12.399 --> 00:39:15.560 We'll try those productions 719 00:39:15.560 --> 00:39:18.439 We'll make another montage 720 00:39:18.439 --> 00:39:21.879 We're going to make a montage on the Enemy 721 00:39:21.879 --> 00:39:27.239 Here, go to Animation, then Animation Montage 722 00:39:27.239 --> 00:39:29.840 We'll select vampire 723 00:39:29.840 --> 00:39:36.840 We'll name this Montage_Enemy 724 00:39:36.840 --> 00:39:39.320 Double-click to open 725 00:39:39.320 --> 00:39:42.159 Here, we're going to add animations 726 00:39:42.159 --> 00:39:44.879 Here, the animation for reacting 727 00:39:44.879 --> 00:39:47.280 Once there's Damage, reactions such as ouch 728 00:39:47.280 --> 00:39:48.199 That will be added 729 00:39:48.199 --> 00:39:51.699 Here, there's Standing_React 730 00:39:51.699 --> 00:39:52.799 And right under it 731 00:39:52.799 --> 00:39:57.479 there's Sword_And_Shield_Impact 732 00:39:57.479 --> 00:40:01.879 Execute it, and it's like this 733 00:40:01.879 --> 00:40:05.520 The two reactions are applied 734 00:40:05.520 --> 00:40:08.199 And while we're on it, we're going to process death 735 00:40:08.199 --> 00:40:09.520 Here, there's Death 736 00:40:09.520 --> 00:40:12.040 We'll add Death here 737 00:40:12.040 --> 00:40:14.340 When it dies, it falls over like this 738 00:40:14.340 --> 00:40:18.840 Those are the motions 739 00:40:18.840 --> 00:40:20.439 To control this 740 00:40:20.439 --> 00:40:22.080 we're going to create a section 741 00:40:22.080 --> 00:40:24.159 Right now, there's only Default 742 00:40:24.159 --> 00:40:27.600 We're going to do Damage 0, Damage 1 743 00:40:27.600 --> 00:40:30.000 We can change the name here 744 00:40:30.000 --> 00:40:33.080 Damage0 745 00:40:33.080 --> 00:40:34.159 And here 746 00:40:34.159 --> 00:40:35.679 This is where it starts 747 00:40:35.679 --> 00:40:37.929 The second one 748 00:40:37.929 --> 00:40:39.919 Select New Montage Section 749 00:40:39.919 --> 00:40:44.879 Here, we'll name it Damage1 750 00:40:44.879 --> 00:40:49.619 Adjust the location well 751 00:40:54.199 --> 00:41:01.600 And here, we're going to name it Die 752 00:41:01.600 --> 00:41:08.239 Die section. Write it like this 753 00:41:08.239 --> 00:41:11.719 That's how we'll configure it 754 00:41:11.719 --> 00:41:16.239 And if you look here 755 00:41:16.239 --> 00:41:18.959 the sections are like this 756 00:41:18.959 --> 00:41:21.399 When it's proceeded 757 00:41:21.399 --> 00:41:23.840 When the montage is played 758 00:41:23.840 --> 00:41:26.120 If it starts from the beginning 759 00:41:26.120 --> 00:41:27.870 0, 1, Die 760 00:41:27.870 --> 00:41:30.040 And it ends. That's the structure 761 00:41:30.040 --> 00:41:33.120 If you see here, once Damage0 ends, do Damage1 762 00:41:33.120 --> 00:41:36.000 then do Die, then end. That's what it says 763 00:41:36.000 --> 00:41:38.679 Press Clear, and they become separated 764 00:41:38.679 --> 00:41:41.840 Now it's separated into sections 765 00:41:41.840 --> 00:41:44.120 This way, when Damage0 section is proceeded 766 00:41:44.120 --> 00:41:46.800 the montage ends there 767 00:41:46.800 --> 00:41:49.639 So if it's configured like this 768 00:41:49.639 --> 00:41:53.800 we can control them by sections 769 00:41:53.800 --> 00:41:59.639 After configuring it like this, let's control it 770 00:41:59.639 --> 00:42:02.120 And here, we're going to create a slot 771 00:42:02.120 --> 00:42:05.320 If you look at the slot here, unlike the player 772 00:42:05.320 --> 00:42:06.879 the contents are a bit different 773 00:42:06.879 --> 00:42:09.840 So here, click Add Slot 774 00:42:09.840 --> 00:42:11.040 And we're going to use Damage Slot 775 00:42:11.040 --> 00:42:13.439 Here's one, Damage Slot 776 00:42:13.439 --> 00:42:17.879 We'll use this as is, Damage Slot 777 00:42:17.879 --> 00:42:22.239 Then this has to be applied to animation blueprint 778 00:42:22.239 --> 00:42:23.760 Go to AnimGraph 779 00:42:23.760 --> 00:42:26.520 We're going to make the slot float here 780 00:42:26.520 --> 00:42:31.080 Type DefaultSlot 781 00:42:31.080 --> 00:42:34.280 DefaultSlot must be added first 782 00:42:34.280 --> 00:42:36.520 Connect it like this 783 00:42:36.520 --> 00:42:38.760 Then we'll change the name here 784 00:42:38.760 --> 00:42:42.800 We'll change it to DamageSlot 785 00:42:42.800 --> 00:42:45.520 You have to pay attention to the name 786 00:42:45.520 --> 00:42:47.400 Change it like this 787 00:42:51.320 --> 00:42:53.600 Then we just need to play it 788 00:42:53.600 --> 00:42:56.520 Save everything 789 00:42:56.520 --> 00:43:01.639 And now, for the function that plays the attack damage 790 00:43:01.639 --> 00:43:05.199 here in the Animation Blueprint 791 00:43:05.199 --> 00:43:08.840 This is where we'll control it 792 00:43:08.840 --> 00:43:12.080 Then 793 00:43:12.080 --> 00:43:14.360 We'll first have to make one 794 00:43:14.360 --> 00:43:16.800 Then Animation 795 00:43:16.800 --> 00:43:20.320 Go to where AnimInstance was inherited 796 00:43:20.320 --> 00:43:25.520 Here, put UFUNCTION 797 00:43:25.520 --> 00:43:29.320 This time, we're going to make this function 798 00:43:29.320 --> 00:43:37.719 void PlayDamageAnim 799 00:43:37.719 --> 00:43:39.199 Should we do it like that 800 00:43:39.199 --> 00:43:45.439 Then for Fname, we'll put section 801 00:43:45.439 --> 00:43:49.320 We'll put sectionName 802 00:43:49.320 --> 00:43:51.439 And implementing this 803 00:43:51.439 --> 00:43:53.360 will not be done within the code 804 00:43:53.360 --> 00:43:55.959 We'll implement it in blueprint 805 00:43:55.959 --> 00:43:57.839 Here, write this 806 00:43:57.839 --> 00:44:03.159 There's something called BlueprintImplementableEvent 807 00:44:03.159 --> 00:44:06.320 If this is done, the actual implementing 808 00:44:06.320 --> 00:44:08.800 is said to be done in blueprint 809 00:44:08.800 --> 00:44:10.959 Then let's go to blueprint 810 00:44:10.959 --> 00:44:12.399 Go here 811 00:44:12.399 --> 00:44:14.320 Here, go to EventGraph 812 00:44:14.320 --> 00:44:18.239 Here, what was the name earlier 813 00:44:18.239 --> 00:44:22.479 PlayDamageAnim 814 00:44:22.479 --> 00:44:24.159 Ah we should compile first 815 00:44:24.159 --> 00:44:26.479 Again, compile 816 00:44:34.879 --> 00:44:39.199 Type Play Damage Anim, and it appears like this 817 00:44:39.199 --> 00:44:43.199 And here, you know the Try Get Pawn Owner? 818 00:44:43.199 --> 00:44:45.159 Bring this 819 00:44:45.159 --> 00:44:46.560 Cast this 820 00:44:46.560 --> 00:44:53.040 It would be Cast to BP_Enemy 821 00:44:53.040 --> 00:44:58.040 Cast it like this 822 00:44:58.040 --> 00:45:00.280 And here 823 00:45:00.280 --> 00:45:02.800 Play Anim Montage 824 00:45:02.800 --> 00:45:05.520 Do that 825 00:45:05.520 --> 00:45:07.000 Then the Section Name here 826 00:45:07.000 --> 00:45:09.000 will be inserted this way 827 00:45:09.000 --> 00:45:10.320 And open it 828 00:45:10.320 --> 00:45:13.159 We're going to use Enemy 829 00:45:13.159 --> 00:45:16.159 So change Anim Montage into Enemy 830 00:45:16.159 --> 00:45:20.320 That's how we'll configure it 831 00:45:20.320 --> 00:45:21.959 Compile it 832 00:45:21.959 --> 00:45:23.560 Then once this function is called 833 00:45:23.560 --> 00:45:27.000 this action will be performed 834 00:45:27.000 --> 00:45:34.639 Then where this is called, will not be here 835 00:45:34.639 --> 00:45:36.639 When damage is received 836 00:45:36.639 --> 00:45:39.439 in FSM 837 00:45:39.439 --> 00:45:41.800 when it's OnDamageProcess 838 00:45:41.800 --> 00:45:44.560 This is where it should be called 839 00:45:44.600 --> 00:45:46.800 Here, it received Damage 840 00:45:46.800 --> 00:45:48.560 It's going to React 841 00:45:48.560 --> 00:45:50.740 And here, it's going to Die 842 00:45:56.360 --> 00:45:59.840 So in EnemyAnim 843 00:45:59.840 --> 00:46:02.719 PlayDamageAnim 844 00:46:02.719 --> 00:46:03.479 like this 845 00:46:03.479 --> 00:46:05.000 Call it here 846 00:46:05.000 --> 00:46:07.520 We'll insert it by TEXT here 847 00:46:07.520 --> 00:46:11.120 Here, type Damage0 848 00:46:11.120 --> 00:46:17.479 Here, we'll have to put Die 849 00:46:17.479 --> 00:46:19.040 But we want to make it random 850 00:46:19.040 --> 00:46:21.080 0 or 1 851 00:46:21.080 --> 00:46:23.239 So we're going to do a random process 852 00:46:23.239 --> 00:46:27.439 First put int32 index 853 00:46:27.439 --> 00:46:34.040 This is random. So in FMath 854 00:46:34.040 --> 00:46:35.800 there's RandRange 855 00:46:35.800 --> 00:46:37.479 We'll use this function 856 00:46:37.479 --> 00:46:40.159 This is 0 to 1 857 00:46:40.159 --> 00:46:43.320 We're going to randomly choose one of these two 858 00:46:43.320 --> 00:46:47.320 Then we're going to insert this here 859 00:46:47.320 --> 00:46:49.000 First, we need to use FString 860 00:46:49.000 --> 00:46:53.679 FString, like this 861 00:46:53.679 --> 00:46:56.639 We'll put sectionName 862 00:46:56.639 --> 00:47:02.040 Then in FString, there's the Printf function 863 00:47:02.040 --> 00:47:04.439 Using this will make it simple 864 00:47:04.439 --> 00:47:15.239 Here, put TEXT("Damage%d") 865 00:47:15.239 --> 00:47:20.360 comma, then index 866 00:47:20.360 --> 00:47:22.040 That's how we'll configure it 867 00:47:22.040 --> 00:47:23.040 So this index here 868 00:47:23.040 --> 00:47:23.719 Oh not index 869 00:47:23.719 --> 00:47:25.469 This sectionName 870 00:47:25.469 --> 00:47:27.679 needs to be inserted after changing it to FName 871 00:47:27.679 --> 00:47:34.199 This will be FName 872 00:47:34.199 --> 00:47:37.159 Write it like this 873 00:47:37.159 --> 00:47:39.269 When changing FString to FName 874 00:47:39.269 --> 00:47:45.040 configure it like this 875 00:47:45.040 --> 00:47:48.840 Then let's compile it now and see the results 876 00:47:48.840 --> 00:47:51.719 Before that, now that I think about it 877 00:47:51.719 --> 00:47:54.199 I left this as Default 878 00:47:54.199 --> 00:47:56.120 We'll change the name again 879 00:47:56.120 --> 00:47:59.679 We put Damage, and we didn't apply it 880 00:47:59.679 --> 00:48:03.239 Save it 881 00:48:03.239 --> 00:48:08.439 And... that should be good 882 00:48:08.439 --> 00:48:11.289 Here, the DamageSlot 883 00:48:11.289 --> 00:48:13.399 is performing the animation 884 00:48:13.399 --> 00:48:16.000 Then execute it, and let's see the results 885 00:48:16.000 --> 00:48:17.750 Shoot it, and like this 886 00:48:17.750 --> 00:48:21.199 You can see that the animation is applied 887 00:48:21.199 --> 00:48:24.520 It kind of falls over weirdly right now 888 00:48:24.520 --> 00:48:26.280 After the falling animation is over 889 00:48:26.280 --> 00:48:29.159 the next motion has to be continued 890 00:48:29.159 --> 00:48:32.120 but it goes down as it falls 891 00:48:32.120 --> 00:48:35.000 So we're going to control this 892 00:48:35.000 --> 00:48:40.600 Here, in the header of FSM 893 00:48:40.600 --> 00:48:42.959 Let's process it here 894 00:48:42.959 --> 00:48:46.840 bAttack. There are no related ones, right 895 00:48:46.840 --> 00:48:49.280 Then we'll write it on the very bottom 896 00:48:49.280 --> 00:48:53.719 Put bool bDieDone 897 00:48:53.719 --> 00:48:56.639 We'll make a variable like this 898 00:48:56.639 --> 00:48:58.479 The role of the variable is 899 00:48:58.760 --> 00:49:00.439 whether the animation is complete 900 00:49:00.439 --> 00:49:02.679 that's what it will be checking 901 00:49:02.679 --> 00:49:06.479 Then go here 902 00:49:06.479 --> 00:49:08.360 When Die Animation is performed 903 00:49:08.360 --> 00:49:12.560 first, put bDieDone as false 904 00:49:12.560 --> 00:49:14.040 Once Animation is finished 905 00:49:14.040 --> 00:49:17.000 then set this to true 906 00:49:17.000 --> 00:49:18.959 And then this becomes true 907 00:49:18.959 --> 00:49:22.560 when you look up 908 00:49:22.560 --> 00:49:26.080 you know the part where Die is being performed 909 00:49:26.080 --> 00:49:28.120 Here, this is blocked 910 00:49:28.120 --> 00:49:30.280 If this is false 911 00:49:30.280 --> 00:49:33.959 then return 912 00:49:33.959 --> 00:49:36.760 Like this 913 00:49:36.760 --> 00:49:39.399 Then there should be a time when this becomes true 914 00:49:39.399 --> 00:49:41.719 Once Animation is over 915 00:49:41.719 --> 00:49:45.439 So we'll process that too 916 00:49:45.439 --> 00:49:49.159 In Montage 917 00:49:49.159 --> 00:49:52.159 for Die, this is going to be processed 918 00:49:52.159 --> 00:49:54.800 And it's going to end here 919 00:49:54.800 --> 00:49:56.439 It will about here 920 00:49:56.439 --> 00:49:59.000 Then if you look here 921 00:49:59.000 --> 00:50:01.080 Die extends here 922 00:50:01.080 --> 00:50:02.120 but we're going to end it here 923 00:50:02.120 --> 00:50:04.600 Let's add an Event here 924 00:50:04.600 --> 00:50:06.840 On the Notify part 925 00:50:06.840 --> 00:50:08.239 write it like this 926 00:50:08.239 --> 00:50:09.800 In Add Notify 927 00:50:09.800 --> 00:50:12.040 the Animation called DieDone 928 00:50:12.040 --> 00:50:13.000 An Event here 929 00:50:13.000 --> 00:50:14.879 Notify will be added 930 00:50:14.879 --> 00:50:19.520 Type DieDone 931 00:50:19.520 --> 00:50:20.679 Should we call it DieEnd? 932 00:50:20.679 --> 00:50:24.959 The same way 933 00:50:25.000 --> 00:50:27.040 Create an End 934 00:50:27.040 --> 00:50:29.159 Then when it Ends 935 00:50:29.159 --> 00:50:31.639 then it has to freeze in this state 936 00:50:31.639 --> 00:50:33.040 But if you look at the structure 937 00:50:33.040 --> 00:50:34.399 it flows like this 938 00:50:34.399 --> 00:50:35.919 And even if there's an Event here 939 00:50:35.919 --> 00:50:37.000 it already ends here 940 00:50:37.000 --> 00:50:39.239 The animation ends 941 00:50:39.239 --> 00:50:40.560 But because of that 942 00:50:40.560 --> 00:50:44.320 if we choose to repeat Die 943 00:50:44.320 --> 00:50:45.719 What happens is 944 00:50:45.719 --> 00:50:48.719 DieDone occurs, it reaches here 945 00:50:48.719 --> 00:50:50.760 Then it will do the same thing from the beginning again 946 00:50:50.760 --> 00:50:54.679 Then this animation will repeat like this 947 00:50:54.679 --> 00:50:55.760 That's awkward 948 00:50:55.760 --> 00:51:00.280 Since it has to repeat the dead state 949 00:51:00.280 --> 00:51:02.479 we'll make another Section here 950 00:51:02.479 --> 00:51:04.719 We'll make it here 951 00:51:04.719 --> 00:51:10.399 So around here, add Section 952 00:51:10.399 --> 00:51:16.639 Should we name it DieLoop 953 00:51:16.639 --> 00:51:20.280 Then it just needs to repeat this part 954 00:51:20.280 --> 00:51:21.919 When it reaches DieEnd 955 00:51:22.120 --> 00:51:24.959 move over to this section 956 00:51:24.959 --> 00:51:27.959 and process it so that it repeats this part 957 00:51:27.959 --> 00:51:30.280 Then for now, Clear them 958 00:51:30.280 --> 00:51:33.679 We're going to proceed with DieLoop after Die 959 00:51:33.679 --> 00:51:35.080 Then once we're at the Loop 960 00:51:35.080 --> 00:51:39.840 repeat infinitely at the Loop 961 00:51:39.840 --> 00:51:42.199 If this goes back to Die 962 00:51:42.199 --> 00:51:46.239 it's going to go back to here, then repeat 963 00:51:46.239 --> 00:51:48.600 But if this is set as DieLoop 964 00:51:48.600 --> 00:51:51.879 the corresponding section will be repeated 965 00:51:51.879 --> 00:51:56.679 Then when the Die Event occurs 966 00:51:56.679 --> 00:51:59.520 and it will go down 967 00:51:59.520 --> 00:52:01.959 and meanwhile, the animation will be repeated in this section 968 00:52:01.959 --> 00:52:05.360 That's how we need to configure it 969 00:52:05.360 --> 00:52:08.919 The Notify of this Event 970 00:52:08.919 --> 00:52:11.199 needs a function process 971 00:52:11.199 --> 00:52:15.040 Then this time, when we processed this all along 972 00:52:15.040 --> 00:52:16.980 here in animation blueprint 973 00:52:16.980 --> 00:52:18.159 in the EventGraph 974 00:52:18.159 --> 00:52:20.199 is where we made it 975 00:52:20.199 --> 00:52:22.239 In truth, we don't make it like this 976 00:52:22.239 --> 00:52:25.800 This AnimNotify_ here 977 00:52:25.800 --> 00:52:28.659 and the name here, like DieEnd 978 00:52:28.659 --> 00:52:31.520 If functions of these names are implemented 979 00:52:31.520 --> 00:52:36.040 if it's declared in the source, the header 980 00:52:36.040 --> 00:52:37.959 we don't need to use this 981 00:52:37.959 --> 00:52:39.760 We don't need to make it this way 982 00:52:39.760 --> 00:52:42.840 So we can do it this way 983 00:52:42.840 --> 00:52:44.600 but we can do it another way 984 00:52:44.600 --> 00:52:45.879 Let's try it 985 00:52:45.919 --> 00:52:49.320 Come here, in Anim 986 00:52:49.320 --> 00:52:51.080 This was that role 987 00:52:51.080 --> 00:52:57.879 Here, type void AnimNotify 988 00:52:57.879 --> 00:53:00.959 including the _ 989 00:53:00.959 --> 00:53:03.399 The name is the same as the name here 990 00:53:03.399 --> 00:53:05.120 AnimNotify_ 991 00:53:05.120 --> 00:53:07.870 The same name from here 992 00:53:07.870 --> 00:53:10.360 is used for creating the function 993 00:53:10.360 --> 00:53:13.600 What we did earlier is DieEnd 994 00:53:13.600 --> 00:53:21.000 Then we'll have to write DieEnd here 995 00:53:21.000 --> 00:53:26.919 We'll give it UFUNCTION here as well 996 00:53:26.919 --> 00:53:29.320 This is needed for reflection 997 00:53:29.320 --> 00:53:32.560 That's how they will recognize it from there 998 00:53:32.560 --> 00:53:36.639 Make the implementations like this 999 00:53:36.639 --> 00:53:42.640 Once DieEnd is reached, what we want to do is, in FSM 1000 00:53:42.640 --> 00:53:50.000 FSM's bDieDone becomes true 1001 00:53:50.000 --> 00:53:52.919 Since the falling motion is over 1002 00:53:52.919 --> 00:53:55.800 now move down into the ground 1003 00:53:55.800 --> 00:53:58.080 We want to do that here 1004 00:53:58.080 --> 00:54:00.360 Then we'll bring this as is 1005 00:54:00.360 --> 00:54:02.800 Bring it here 1006 00:54:02.800 --> 00:54:10.800 Put bDieDone = true 1007 00:54:10.800 --> 00:54:16.639 Write it like this 1008 00:54:16.639 --> 00:54:19.840 Compile it, and let's see the results 1009 00:54:19.840 --> 00:54:23.979 Compile it here 1010 00:54:27.879 --> 00:54:28.959 Execute it 1011 00:54:28.959 --> 00:54:31.909 Shoot it, bang 1012 00:54:31.909 --> 00:54:33.399 It pauses, then approaches again 1013 00:54:33.399 --> 00:54:36.879 Then bang! It falls, and then 1014 00:54:36.879 --> 00:54:39.579 Once it's over, move down 1015 00:54:39.579 --> 00:54:43.239 It should move down but it's not 1016 00:54:43.239 --> 00:54:46.320 Let's check this again 1017 00:54:46.320 --> 00:54:49.060 When checking this, first 1018 00:54:49.060 --> 00:54:50.919 try making Notify here again 1019 00:54:50.919 --> 00:54:55.320 When it's implemented into the header 1020 00:54:55.320 --> 00:54:58.320 if it's properly implemented here 1021 00:54:58.320 --> 00:55:01.159 we shouldn't be able to make it here 1022 00:55:01.159 --> 00:55:02.800 It's DieEnd, right 1023 00:55:02.800 --> 00:55:04.560 It's being made 1024 00:55:04.560 --> 00:55:06.879 There's something wrong 1025 00:55:06.879 --> 00:55:08.639 Maybe a typo 1026 00:55:08.639 --> 00:55:14.560 Ah I misspelled it 1027 00:55:14.560 --> 00:55:18.199 It's Notify, but there was a typo 1028 00:55:18.199 --> 00:55:21.620 We'll change the name like this 1029 00:55:27.840 --> 00:55:29.140 Like this 1030 00:55:32.500 --> 00:55:34.560 Execute it, and let's see 1031 00:55:34.560 --> 00:55:39.079 And when we implement it like this 1032 00:55:39.079 --> 00:55:42.399 the AnimNotify_DieEnd node earlier 1033 00:55:42.399 --> 00:55:45.320 shouldn't exist in the animation blueprint 1034 00:55:45.320 --> 00:55:46.320 It will cause error 1035 00:55:46.320 --> 00:55:50.360 So you need to check that first 1036 00:55:50.360 --> 00:55:53.040 Here, there's an error 1037 00:55:53.040 --> 00:55:57.479 The error here 1038 00:55:57.479 --> 00:56:00.520 It's implemented in the code, so you can't use it here 1039 00:56:00.520 --> 00:56:02.320 That's what it means 1040 00:56:02.320 --> 00:56:06.000 Delete it 1041 00:56:06.000 --> 00:56:11.760 Execute it and see the results. Bang, bang 1042 00:56:11.760 --> 00:56:17.080 After falling, it goes down like this 1043 00:56:17.080 --> 00:56:20.520 I'll summarize the content learned in this unit 1044 00:56:21.629 --> 00:56:22.879 Changing the appearance of the enemy and synchronizing C FSM and animation FSM Changing the appearance of the enemy Edit the data path and size of the enemy's appearance in Enemy.cpp 1045 00:56:22.879 --> 00:56:24.079 Create animation blueprint and select vampire_a_lush_Skeleton, then name it WBP_Enemy 1046 00:56:24.079 --> 00:56:25.229 Create the FSM state machine, then add Idle, Move, and Attack state motions Connect the transitions of state motions and set the conditions that fit each transition 1047 00:56:25.229 --> 00:56:26.279 Synchronizing C FSM and animation FSM Declare the variable that will remember the animation blueprint being used in EnemyFSM.h 1048 00:56:26.279 --> 00:56:27.329 Create Attack Notify in the animation sequence editor of Mma_Kick Add the AttackEnd Notify node in the animation blueprint editor of WBP_Enemy 1049 00:56:27.329 --> 00:56:28.529 After declaring the function that processes the attack time and the end time of attack in EnemyAnim.h, then add the implementation in EnemyAnim.cpp 1050 00:56:28.529 --> 00:56:29.979 Attack and death animation sequence configuration Attack animation Select vampire_a_lush_Skeleton as the new Animation Montage and name it Montage_Enemy 1051 00:56:29.979 --> 00:56:31.429 Add 2 attack animations and set it as Damage0 and Damage 1 After adding DamageSlot, select DefaultGroup.DamageSlot as the slot that the Montage will use 1052 00:56:31.429 --> 00:56:32.829 In the AnimGraph window of WBP_Enemy, add the [DefaultSlot] node and connect FSM to the Source input data part and connect the result to the [Output Pose] 1053 00:56:32.829 --> 00:56:33.929 Create and process the function for processing the attack animation play 1054 00:56:33.929 --> 00:56:35.029 Death state animation Add the Zombie_Death motion and add the Die section Process the death animation play in EnemyFSM.cpp 1055 00:56:35.029 --> 00:56:36.119 At the part where the death animation ends in Enemy Damage Montage, add DieLoop Notify Event and process it so that DieLoop repeats